473,221 Members | 1,749 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,221 software developers and data experts.

Re: TCP listener - check for connection status

On Wed, 06 Aug 2008 08:33:55 -0700, Markgoldin <ma*************@yahoo.com>
wrote:
tcpl = new TcpListener(ipe);
TcpClient tcpc = tcpl.AcceptTcpClient();
while (true)
{
// get data
while (true)
{
// if contidion met break;
}
}

How can I check if a client has been disconnected from the listener?
Try to send something.

Connection status can only be determined when you send data. If the
connection is broken when you send data, you'll get an exception.
Otherwise, you won't receive any notification.

You can design your protocol to send periodic "keep alive" messages, but
that's not usually the right thing to do. It's a _good_ thing that TCP
doesn't detect a broken connection until you actually try to use it. That
allows transient problems to occur without affecting your connection.

Pete
Aug 6 '08 #1
1 5650
Good answer. When you think about it, it would not even be possible without
some kind of keepalive because your never going to get any back channel
notification that the host is down or a link was broken until you actually
try to send a packet. Unless your waiting on some push notification deal, a
keepalive is not desired anyway.

--william

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Wed, 06 Aug 2008 08:33:55 -0700, Markgoldin <ma*************@yahoo.com>
wrote:
>tcpl = new TcpListener(ipe);
TcpClient tcpc = tcpl.AcceptTcpClient();
while (true)
{
// get data
while (true)
{
// if contidion met break;
}
}

How can I check if a client has been disconnected from the listener?

Try to send something.

Connection status can only be determined when you send data. If the
connection is broken when you send data, you'll get an exception.
Otherwise, you won't receive any notification.

You can design your protocol to send periodic "keep alive" messages, but
that's not usually the right thing to do. It's a _good_ thing that TCP
doesn't detect a broken connection until you actually try to use it. That
allows transient problems to occur without affecting your connection.

Pete
Aug 6 '08 #2

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

Similar topics

1
by: Cherrish Vaidiyan | last post by:
sir, I have a small error in Listener configuration.I have two system with a database in each. I am using Red Hat 9 and Oracle 9i. so i shall anme the database and system. system 1 - node2 ...
5
by: Axel Dachtler | last post by:
Hi, I have a listener problem. The listener cannot read SERVICE_NAME in TNS-Descriptor. The service-name I specified in Oracle Net Manager for this database is testdb as well. ...
6
by: Ellen K. | last post by:
Hi all, I'm a developer. While at my current job I've been working with mostly SQL Server, now I need to connect to our Oracle Financials running on HP-UX. The Oracle DBA set me up as a user...
1
by: Agnes | last post by:
in form_load, i will new a sql connection ,fill in the dataset and then close the connection. I use Netstat to check the status. (1)Open the form , The status to the SQL server is "ESTABILISHED"...
2
by: Pete | last post by:
Hi All, I am using VB.NET and TCP/IP synchronous sockets to connect to listener software on another machine. I was wondering if anyone could help me understand how to automatically detect and...
5
by: mivey4 | last post by:
Hi, First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point,...
4
by: Sir C4 | last post by:
Can someone give a quick example of how to check for activity on a TCP port? For example, I'd like to watch and listen for activity on port 80. Once activity is detected, I'd like an event to be...
1
by: tensi4u | last post by:
Hello, everyone. I began to work with DB2 V8.1 for Linux on debian from last month, I'm beginner to DB2, and I have two questions. First, searched articles related to "number of connection" at...
1
by: michael ngong | last post by:
michael.john@gmx.at (Michael John) wrote in message news:<90cc4edd.0306230900.28075193@posting.google.com>... MIchael I you stated the OS and platform that could make it easier to address your...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.