Reputation: 115
In my server prosgram, I have shutdown the recv end of socket to refuse the incoming data.
Sometimes later in the code i wish to check if my recv end is closed or not. How can i check this? I didnt find anything interesting in getsockopt.
Thanks, Sandeep
Upvotes: 0
Views: 463
Reputation: 215259
Probably by storing a flag alongside wherever you store the socket fd. Surely that will be more efficient than making additional syscalls...
Upvotes: 1
Reputation: 2384
How about getsockopt(/*SO_CONNECT_TIME*/)
?... it will return SOCKET_ERROR
of the socket isn´t connected...
I suggest You to use closesocket() on the socket to ensure it has been really closed and not only shut down.
Upvotes: 0