Connection state ?
Connection state ?
Connection state ?
Connection state ?
Connection state ?
Connection state ? Connection state ? Connection state ? Connection state ? Connection state ? Connection state ? Connection state ? Connection state ?
Connection state ? Connection state ?
Connection state ?
Go Back  Xtreme Visual Basic Talk > > > Connection state ?


Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2004, 04:07 PM
vampire vampire is offline
Freshman
 
Join Date: Dec 2002
Posts: 31
Default Connection state ?


Hiya !

Searched this forum but couldn't seem to find an answer on the next question :
How can I check if my tcpClient is still connected on serverside ? (And also the other way around: check if the tcpClient is still connected to the tcpListener ?)

First I was thinking on sending a PING - PONG message on random moments... but that isn't an efficient way of testing...

Then I checked out the "Socket" class, which does have a prop "connected" and "available" (what the tcpClient & tcpListener don't have)

So... should I not work with tcpListener and tcpClient and only use "Socket" ???

Any help / info welcome !
Reply With Quote
  #2  
Old 10-30-2004, 10:17 AM
MKoslof's Avatar
MKoslofConnection state ? MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Why can't you use the tcpclient.connected property, which returns a boolean? Can we see some of your code..maybe that would better explain the problem .
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #3  
Old 10-30-2004, 10:23 AM
vampire vampire is offline
Freshman
 
Join Date: Dec 2002
Posts: 31
Default

well, cause it's not the property list ?

What I do at the serverside is : (these lines are only to accept the client of course, the most important ones since I create a new client here )
dim mClient as new tcpClient

in the wait_for_connection method I set mClient = mListener.AcceptTCPConnection

and that's it... ?

Last edited by vampire; 10-30-2004 at 04:33 PM.
Reply With Quote
  #4  
Old 11-06-2004, 04:57 AM
throwaway18 throwaway18 is offline
Contributor
 
Join Date: May 2004
Posts: 504
Default

There is a fundamental problem with checking the state of connections over the internet.

Machine A has a TCP connection open to machine B. When no data is being transfered over the connection there are no packets sent between the machines. If either machine is shut down for the software using the connection on either machine is closed then an RST packet is sent to tell the other computer then the TCP connection is closing.

If the power or network cable is pulled out of a machine or a modem connection drops abruptly then no RST packet is sent. The other machine does not find out that the connection has dropped until it tries to send some data over the link and gets either no acknowledgement, a destination unreachable reply from the router closest to the dead machine or an RST from a different machine that has been given the ip the dead machine was using.

A PING PONG style check is the only reliable way to check that the other machine is still there.

The problem is compounded by some connection sharing systems that silently drop open but inactive TCP connections after as little as 15 minutes.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Connection state ?
Connection state ?
Connection state ? Connection state ?
Connection state ?
Connection state ?
Connection state ? Connection state ? Connection state ? Connection state ? Connection state ? Connection state ? Connection state ?
Connection state ?
Connection state ?
 
Connection state ?
Connection state ?
 
-->