Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Connected Property
dboris

From: Blackwood, NJ USA
Posts: 7
Member Since: 09/10/03
posted September 10, 2003 9:46 AM

I am having some trouble with the Connected Property. I setup a Sockets.Server object to listen for incomming connection. Once I get the connection the TCP object correctly has it's connected property set to true. But when I close the client application (in this case a VB6 program) the connected property remains true. I also tried it with a client using PowerTCP and have the same problem. Any ideas how to get a the true status of a connection?



Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted September 10, 2003 9:54 AM

Can you please suggest the best way to duplicate this problem using the Echo server example? I need to know the exact place where you are checking the connected property.
dboris

From: Blackwood, NJ USA
Posts: 7
Member Since: 09/10/03
posted September 10, 2003 10:19 AM

It works ok with the echo server program since it is constantly sending and recieving on the socket, but if I modify Execute() in Connection.vb to remove the line that does the echo(see below), the connected property will never change to false when the client disconnects.

Public Sub Execute()
    Try
      'While connected, echo received data
      Do While m_Tcp.Connected
        'm_Tcp.Send(m_Tcp.Receive.ToString)
      Loop
    Catch ex As Exception

    End Try
  End Sub
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted September 10, 2003 12:20 PM

If you are going to write an app that is dependent on the Client being connected for it's existence, you won't be able to do it that way.

Normally a client connection is going to be sending data or expecting data at any given time. In that case you would get an exception when the send or receive failed.

In your case the connection is idle so the state will never go to closed until you attempt to send or receive. This means that you will always have to have a Receive pending so you won't be able to use blocking methods. Instead you need to write your app using the Async methods.


Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX