Home Segments Index Top Previous Next

732: Mainline

Once a socket is constructed and is decorated with information, and a client connection has been accepted, then it is time to assign pointer variables that make the socket look like a file from the perspective of functions such as fscanf and fprintf. The server program developed here both reads from and writes to the socket; accordingly, both a read file pointer and a write file pointer have to be created:

fm_client = (FILE *) fdopen (new_socket_number, "r"); 
to_client = (FILE *) fdopen (new_socket_number, "w");