Network disconnection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Network disconnection

Emiliano Pérez-2
Hi,

im working on a discovery service that works with wired and wireless  
conections.
It will be running in desktops, laptops and PDAs so the service needs  
to detect disconnections and reconections properly and on the fly.

Some testing and research took me to this thread from Michael  
Lucas-Smith (Socket Disconnection) in wich he bumped into a similar  
problem. Then the suggested solution was to use stream-like  
communications, and that would solve the readWait lock, but that isn´t  
enough in this case because i also need to detect the difference  
between disconection and network silence.

Is sending a void message the only way to detect disconnection? I  
mean, if the SO detects disconnections immediately can´t I capture  
that same event from VW?

Im avoiding any SO dependent aproach because the service is cross-platform.

---------
Emiliano Guillermo Pérez
[hidden email]



----------------------------------------------------------------
Este mensaje ha sido enviado utilizando IMP desde LIFIA.

Reply | Threaded
Open this post in threaded view
|

Re: Network disconnection

Reinout Heeck
> im working on a discovery service that works with wired and  
> wireless conections.
> It will be running in desktops, laptops and PDAs so the service  
> needs to detect disconnections and reconections properly and on the  
> fly.
>

>
> Is sending a void message the only way to detect disconnection? I  
> mean, if the SO detects disconnections immediately can´t I capture  
> that same event from VW?


Note that there are several levels at which connectivity detection is  
done by the OS:

-Physical: a device or cable has been plugged in, heartbeat from a  
remote device (usually hub) is detected.

-IP: an ICMP message was generated in response to a packet you sent  
('no route to host' etc)

-TCP: no response was received after resending a packet several times.


Looking this over you will probably agree that only local physical  
disconnection can be detected immediately, the other two case require  
sending a packet and then waiting for some length of time for absence  
of a response.

In the case of UDP you will need to code the wait-for-response-after-
several-retries yourself, in the case of TCP this is handled by the  
OS. Neither of these work while no data is sent, you need to move  
packets to do the detection. Neither is 'immediate' since detection  
requires waiting.





HTH,

Reinout
-------