next up previous Back to Operating Systems Home Page
Next: A4 - select(2): what's Up: 1998 term messages Previous: Re: A4 - select(2)

A4: socket closing

> Firstly, there must be a signal which either end receives when the socket
> is closed down by the opposite end.  

SIGPIPE on the next write(2). A read(2) on a socket closed on the 
other side returns 0.

>       Also, when I am exiting after the client sends a "BYE" to the
> server.  I attempt to close FILE* pointers which I have been using for
> reading to and from the socket (calling fclose(2)) and I also attempt to
> close the socket by calling close(socket) but both these return
> errors...is this bad....am I closing the connection properly?

If you promoted the socket to a FILE* using fdopen(3) then you must
close it using fclose(3), so to remove the struct FILE that was allocated
by fdopen.  This is all I can tell without looking at your code: there
might be a bug somewhere else.

Ciao
Franco


\ Franco Callari