TCP Client detects TCP Server?

G

Guest

I want my TCP client to be able to to tell if there is a TCP Server running
at the specified IP address and port number without creating exceptions,
because this code will be put in an infinite loop that will keep checking to
detect when the Server is up. How can I do that?

I wrote TCP client and TCP server applications using TCPClient and
TCPListner objects.

Currently at the Client side, I create a NetworkStream and use the GetStream
to establish a communication channel between the client and the server. The
problem with this approach is that the client will hang on until a connection
is found or until it times out.
 
G

Guest

Currently at the Client side, I create a NetworkStream and use the
GetStream to establish a communication channel between the client and
the server. The problem with this approach is that the client will
hang on until a connection is found or until it times out.

You should open the connection in it's own thread... or via async calls.

This will allow your GUI to continue without hanging.
 
G

Guest

I never mentioned a GUI interface. In fact I don't have one, since I'm using
Windows Services. I was hoping to get something similar to pinging the Server
and return a True or False to determine if the server was up or not, instead
of making exceptions in my loop!
 
G

Guest

I never mentioned a GUI interface. In fact I don't have one, since I'm
using Windows Services. I was hoping to get something similar to
pinging the Server and return a True or False to determine if the
server was up or not, instead of making exceptions in my loop!


I don't think the built in TCP classes support this feature.
 

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