Re: getting the error status of a socket




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

.



Relevant Pages

  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... kernel socket family. ... presentation side is left to the client. ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #2]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • Re: Socket Exception
    ... In this case the server most likely rejected your ... connection. ... Each command is a new socket connection that is opened and closed ... /// Required designer variable. ...
    (microsoft.public.win32.programmer.networks)
  • Re: attn:MVPs
    ... winsock dll to the managed .net environment. ... I have an asynchronous TCP socket that listens for data from ... The Slave should not initiate any connection requests/ send other messages ... EXCEPT the acknowledgement for the incoming messages from master, ...
    (microsoft.public.dotnet.framework)