Re: checking a socket status

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



Do you ever call recv? If the communication protocol is such that you
only send messages, but don't receive confirmation to them, then there's
a chance that a message that you think is received on the other end

yes I do exactly that. I send a message called "hello" and than the other
end responds in "hello_ack" (while I'm still in recv) after which I indicate
in the gui that the message was successfuly sent. But after gui notification
I have nothing more to do but wait for someone to click on the gui's one
button to send the message again and after which i call recv again to get
the acknowledgment. This cycle repeats. And the way I'm stopping the thread
is through waitforsingleobject as i explained in my previous reply.

Ab.


"Mihajlo Cvetanoviæ" <mac@xxxxxxxxxxxxxxxxxx> wrote in message
news:#2DwPaaSGHA.4960@xxxxxxxxxxxxxxxxxxxxxxx
Abubakar wrote:
Now for client disconnection notifications purposes I need to be
informed at
any time when the socket connection breaks so that I can do some gui
updates
based on this. But as you have read above, since I'm in a blocking call
to
waitforsingleobject, I cant call "send" or recv. Should I have another
thread calling "send" with zero buffer length after equal interval just
to
check if this socket connection is going fine or not? This doesnt seems
nice
idea to me.

Do you ever call recv? If the communication protocol is such that you
only send messages, but don't receive confirmation to them, then there's
a chance that a message that you think is received on the other end
actually isn't received at all.

There are situations when even the TCP/IP stack (in the operating
system) "thinks" that the connection is alive, while it is really dead
(I call them zombie connections). If TCP/IP stack believes this, so
shall you. Your first an last line of defense of these situations is a
communication protocol that facilitates request-response mechanism. If a
response doesn't arrive in a timely fashion (you get to choose the
time-out period) then you declare a time out on a connection and declare
the connection dead for all practical purposes.

The use of such protocol can't be "workarounded" if you need to know
whether the message is *processed* on the other end (and *that* is what
you actually want to know, and not whether the message arrived, or even
whether the connection is broken).


.



Relevant Pages

  • Re: I dont beleeeve it!
    ... tell the driver the usual response is "I know". ... I made sure that the connection was cleaned properly and increased the ... chance that I'd be collecting a BMW in the boot if it wasn't. ... way as the BMW passed me was quite surprising considering how many BMW ...
    (uk.rec.cars.maintenance)
  • Re: Can a car be registered to a non driver ?
    ... connection, they would find it almost impossible to show it was ... higher chance that it was the specific person being sued. ... downloader, so the remaining one had a 46% chance, that would still ... Where the law is not clear, ...
    (uk.legal)
  • Re: Can a car be registered to a non driver ?
    ... connection, they would find it almost impossible to show it was ... I think there is a very good chance they would, ... have been the respondent. ... downloader, so the remaining one had a 46% chance, that would still ...
    (uk.legal)
  • Re: ask user before closing application...
    ... windowAdapter method then the app doesn't close at all whether I choose ... yes or no for the confirmation dialog. ... public class LDAPMgr extends JFrame { ... Since I technically didn't need a connection established to test this my connection was null which meant I was hitting my nullPointerException situation above where I was simply returning from the windowClosingmethod. ...
    (comp.lang.java.gui)
  • Re: Free WiFi was "Camping" at Wal-Mart
    ... Why is the assumption that the connection is "freely ... Why pick on some poor slob who just plugged in the equipment ... People providing a service for business reasons ... Some folks think "There's a chance it's not legal or ethical." ...
    (rec.outdoors.rv-travel)