943,861 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 4194
  • C RSS
Feb 4th, 2007
0

Checking if the socket is valid in C

Expand 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.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Posting Pro in Training
MIGSoft is offline Offline
472 posts
since Jul 2005
Feb 5th, 2007
0

Re: Checking if the socket is valid in C

Click to Expand / Collapse  Quote originally posted by MIGSoft ...
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)
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: implement semaphore without the use of while or any if statement
Next Thread in C Forum Timeline: Gems programming





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC