Ping - Connection Check

M

Martin Waller

Hello,

my mobile application for pocket PC must communicate to a server (TCP/IP
wireless). Therefore I use the class TCPClient to open a connection and do
data exchange.
But when the server is temporarily offline on starting my application then
the TCPClient.Connect method runs in a blocking situation with unlimited (?)
timeout and my application is frozen at this time.
What can I do to avoid this?
I tried to use a kind of ping but this command is not available in the
compact framework 1.1. I can not find a property of TCPClient to influence
the blocking mode or connection request timeout.

Thanks for any useful help !!!!!
 
R

Rüdiger Kardel

Martin,

use asynchronous communication.
Take a look at the Socket class and there at BeginReceive() EndReceive().

Ping should be available in the OpenNETCF.

Ruediger
 
P

Paul G. Tobey [eMVP]

And, it should be noted, this is *not* an indefinite time-out. It's a
period of time long enough to make sure that the target machine isn't just
all the way around the world on an unreliable network where a few packets
might get dropped occasionally. It should time-out in 45 seconds to 2
minutes, depending on the device settings.

Paul T.
 
P

Pete Vickers [MVP]

Hi,
check the IP address of the device before trying to send.

If it is 127.0.0.1 then you have lost your connection.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top