473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

TCP Client detects TCP Server?

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.
May 26 '06 #1
1 1341
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!

"Spam Catcher" wrote:
=?Utf-8?B?QW1qYWQ=?= <Am***@discussions.microsoft.com> wrote in
news:D2**********************************@microsof t.com:
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.

May 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: R. Rajesh Jeba Anbiah | last post by:
Anyone knows how ASP detects frame? I couldn't find any PHP solutions yet. TIA -- | Just another PHP saint | Email: rrjanbiah-at-Y!com
12
by: Cliff Wells | last post by:
Hi, I'm writing an application that needs to know if an Internet connection is available. Basically, I want to have something similar to what a lot of email clients have, where the app can work...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
1
by: Raj | last post by:
Hi, I want to detect a s/w installed on the browser client machine and change my asp.net application's behavior according to that. I already have the javascript to detect the s/w installed on the...
2
by: Martin Eyles | last post by:
I would like to embed a windows controls or smart client controls in a web page, in a similar way to which a java applet or a flash applet or an active x control is embedded. I read something...
20
by: piggy | last post by:
I have developed an application using C# under .NET 2.0 framework. It is almost done and it is time for me to think about deploymnet to all users. I don't have any background about this and would...
0
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie of this stuffs, We had a small office network (1 Windows 2K - Server) and (3 Windows XP - Client). I am testing to 1 PC (Windows 2K) installed with Licensed Wingate...
16
by: Mariano | last post by:
Then, I have one client and one server connected trough TCP socket. When server is listening, client can establish new connection to it. Every time that new client try to start the connection, the...
5
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... I've got a .Net client to a soap service that works for the most part, but there are a couple of things I'd like to improve: 1) the first request to the client wrapper always takes...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.