Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

socket_accept.c File Reference

#include <stdio.h>
#include "libcomm.h"
#include <pthread.h>

Functions

void thread2 (struct LIBCOMMPTHREADP *libcommpthreadp)
 This is a part of socket_accept() and must not called from the user. More...

int socket_accept (int sockport, int id, void(*socket_accept_do)(int fd, int id, char *pip, struct sockaddr_in their_addr))
 Start a new thread, wait for connections and start socket_accept_do() when someone connects. More...


Function Documentation

int socket_accept int    sockport,
int    id,
void(*    socket_accept_do)(int fd, int id, char *pip, struct sockaddr_in their_addr)
 

Start a new thread, wait for connections and start socket_accept_do() when someone connects.

Parameters:
sockport  (int) descriptor of a tcp socket/port from socket_bind()
id  (int) arbitrary id of background process / thread. (May be it is a good idea to use the portnumber.)
aocket_accept_do  (int fd, int id, char *pip, struct sockaddr_in their_addr) (function) this function is called if somebody connects. fd is the descriptor of the new socket to the connected tcp-tream. id is the same as in socket_accept(). pip contains the ip-address of the connected client. The structure their_addr contails all known information about the connected client.
Returns:
If all right zero otherwise non zero.

void thread2 struct LIBCOMMPTHREADP   libcommpthreadp
 

This is a part of socket_accept() and must not called from the user.

This function is the thread which is started from socket_accept() and runs in background.


Generated on Thu Feb 17 10:17:23 2005 for FinalYearProject,A.Hofmeier:CommunicationLibrary by doxygen1.2.15