News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Disconnected socket gets Destroyed  
by djrud
posted on 2005/06/27

Hi,

Im using sockets from the securesocket class within VB.NET for connecting to different FTP servers. I have put these sockects in an array of sockets. At regular interval I wanna check if the sockets are still connected.

Declaration of the array

Dim arrSockets(10) as Org.Mentalis.Security.SSL.SecureSocket

I use this method: arrSockets(counter).Connected (Result: True/False) to check if a certain socket is still connected.

Now when the sockect gets disconnected from server (the hard way, just a connection loss when e.g. the server went down) I get an error when checking the status using the above method.

When I look into the array, the place where the socket is, gives 'Nothing' as value. So the socket is apparently destroyed.

So I have 2 questions:

1. Do anybody know why the socket gets destroyed, and not giving the status disconnected?
2. How do I check on a 'Nothing' value, to determing if the socket is destroyed? (I could then declare a new socket and replace the destroyed one with a new one)

Thx,

Greetz,
djrud

by Viking
posted on 2005/10/19

Connected property returns connection status based on the latest read/write operation on socket.
So if the connection was broken somewhere in-between, this property still returns true.

BTW, how to learn the connection status if using asynhronous sockets?
To find out this status for synhronous sockets, one can use Poll + Available.

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.