Checking if the socket is valid in C

Reply

Join Date: Jul 2005
Posts: 472
Reputation: MIGSoft is an unknown quantity at this point 
Solved Threads: 1
MIGSoft's Avatar
MIGSoft MIGSoft is offline Offline
Posting Pro in Training

Checking if the socket is valid in C

 
0
  #1
Feb 4th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Checking if the socket is valid in C

 
0
  #2
Feb 5th, 2007
Originally Posted by MIGSoft View Post
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)
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC