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: Refresh all connections
computeronsite

From: Calgary, AB Canada
Posts: 45
Member Since: 06/12/02
posted December 20, 2004 12:08 PM

When the connections are being opened and closed from different threads is there a way to refresh the collection of connections?
such as in this line of code:

Tryagain:
Try
      For Each TcpObJect In MyServer.Connections
        TcpObJect.Send("*lost*" & e.Tcp.Tag & vbCrLf)
      Next
    Catch Ex As Exception
'''refresh connections here and try again
      GoTo tryagain
    End Try


If another thread alters the connections then this will cause the code to loop for a lengthy time.

I'd like to either refresh before starting the 'try' so an error wont occur or refresh in the catch statement so when it trys again it has a better chance at all connections.

Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 20, 2004 2:39 PM

I would write a function that returns true if the loop succeeds and false the first time it fails.

Just keep calling the function until it returns true.
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX