DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   Checking if the socket is valid in C (http://www.daniweb.com/forums/thread69090.html)

MIGSoft Feb 4th, 2007 4:54 am
Checking if the socket is valid in C
 
Hi, does anybody know how check whether the socket (ie file descriptor) is valid in C? I know it is probably possible to do it using either a read or a write command, however, what other ways are there? Thanks.

WolfPack Feb 5th, 2007 5:46 am
Re: Checking if the socket is valid in C
 
Quote:

Originally Posted by MIGSoft (Post 310532)
Hi, does anybody know how check whether the socket (ie file descriptor) is valid in C? I know it is probably possible to do it using either a read or a write command, however, what other ways are there? Thanks.

Depends on the socket that you are using. If you are using the berkely sockets, they have (I think) -1 as the value for the invalid socket. Look up the documentation for this. The Winsock API uses the INVALID_SOCKET value to determine an invalid socket. (Look up the Winsock API Documentation)


All times are GMT -4. The time now is 10:48 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC