Connected Status on Sockets

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: BillRay (BillRay_at_discussions.microsoft.com)
Date: 01/05/05


Date: Wed, 5 Jan 2005 14:39:12 -0800

I have created a socket application in C++.NET that connects in non-blocking
mode. All my previous apps of this kind have used blocking mode at the
connection, but in this case I did not want the app to wait if the server was
not available. In the course of doing this, I discovered after several
hours of frustration that the Connected property of the socket is not set in
non-blocking mode even after the connection is completed. Maybe this is
documented someplace, but I could not find it. Is this behavior to be
expected or have I got an error someplace else? I got around this by using
Poll instead to check for the connect status, but I would still like to know
why Connected is not working.

Thanks,

Bill



Relevant Pages

  • Re: DNS Errors ?
    ... domain admin acct. ... The apps start every 15 minutes and attempt to download from the same web ... ** InnerException System.Net.Sockets.SocketException: A connection attempt ... Socket s4, Socket s6, Socket& socket, IPAddress& address, ...
    (microsoft.public.dotnet.general)
  • Re: on the semantics of connect(): EINTR, EALREADY, EINPROGRESS
    ... assume fd is a file descriptor referring to a blocking, ... If the connection cannot be established ... the socket, connectshall block for up to an unspecified timeout ... Since it's then essentially a non-blocking connect, ...
    (comp.unix.programmer)
  • Re: Socket Server... Why two?
    ... I hope you meant non-blocking way ... The accept just accepts a connection and returns as soon ... It is just an information to the application that now one more socket ... nothing to do without that data, you can do a blocking recv(). ...
    (comp.unix.programmer)
  • Re: Socket Server... Why two?
    ... I hope you meant non-blocking way ... The accept just accepts a connection and returns as soon ... It is just an information to the application that now one more socket ... nothing to do without that data, you can do a blocking recv(). ...
    (comp.unix.programmer)
  • Re: NIO
    ... >> non-blocking, which means that it will return from your .writeright ... >> 1) establish a connection using a non-blocking socket connect ... > This is generally pointless unless you want to timeout the connection ... > selecting for it really ...
    (comp.lang.java.programmer)