Re: getting the error status of a socket
- From: "Ali" <abdulrazaq@xxxxxxxxx>
- Date: 5 Jan 2007 09:36:10 -0800
Abubakar wrote:
Hi,
what i'm trying to do is make a function that if passed a SOCKET s, would
tell me if its still connected or not. I'm using tcpip sockets (connection
oriented of course). The problem that I'm having is that i'm unable to do
that. After some research I found that the socket library's "select"
function can help (thats what my understanding is/was). So I used select()
function as follows:
fd_set fd;
FD_ZERO(&fd);
FD_SET(m_s, &fd);
struct timeval tv;
tv.tv_sec = timeout;
tv.tv_usec = 0;
int ret = select(1/*this param is ignored, says msdn*/,
NULL /*writefds*/,
NULL /*readfds*/,
&fd /*exceptds*/,
&tv /*timeout*/);
First question: is this code ok related to what I'm trying to do?
second: the ret variable always seems to return 0 but that doesnt help me.
It returns 0 even when the other side (peer to which I was communicating
with this socket) has been disconnected. What do I check for here?
Regards,
-ab.
Hello Abubakar,
can you come again? i mean its hard to understand what actualy
you are trying to do;-) can you elaborate a bit more so someone here
might be helping you !
ali
.
- References:
- getting the error status of a socket
- From: Abubakar
- getting the error status of a socket
- Prev by Date: Re: Named pipe problem
- Next by Date: Re: Named pipe problem
- Previous by thread: getting the error status of a socket
- Next by thread: Re: getting the error status of a socket
- Index(es):
Relevant Pages
|