[ee122] checking dropped connections

Daniel Killebrew dank at eecs.berkeley.edu
Sun Sep 23 21:08:49 PDT 2007



miken087 at berkeley.edu wrote:
> How do you check if the server has stopped running?
Won't connect fail?
>  Currently my code does
> error checking to see if a socket was created, but in the case when the
> server suddenly stops, my client just quits out without outputting an
> error. However when I gdb through it, I find out that I get a broken pipe
> signal on my send command (at this time the server is already down).
You should check the return value for all networking function, including 
send, to catch any errors.
>  Also
> for error handling, do I display the error message with perror or printf?
>   
For the errors where we gave you specific error messages to print, print 
them out exactly as directed (meaning printf). For the more general 
'network error' message, you may use perror (as long as it prints out 
something helpful).

Daniel
> Michael Ngo
>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>
>   


More information about the ee122 mailing list