TScSSHClient.Connect WSAGetLastError overwritten to 0

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
Memnarch
Posts: 5
Joined: Tue 04 Oct 2011 08:12

TScSSHClient.Connect WSAGetLastError overwritten to 0

Post by Memnarch » Tue 08 Nov 2011 12:47

Hi,
Just noticed if i receive an exception in

MyClient.Connect()

int prints the WSAGetLastError number into the exception message. Calling WSAGetLastError inside the exceptionblock however returns 0. It seems that it has been overwritten within the Connect function.

i would prefer to use WSAGetLastError for receiving detailed info at runtime for my own exception handling.

Greetings
Memnarch

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 11 Nov 2011 13:16

The last error code is cleared by the CloseSocket procedure that is called in the case of wrong connection.
SecureBridge returns an exception with the exact error code and you can read about this error in details on MSDN.

Memnarch
Posts: 5
Joined: Tue 04 Oct 2011 08:12

Post by Memnarch » Sun 13 Nov 2011 14:59

Shure, i can read about it in the MSDN but i cannot react to it at runtime easily. If its overriden by the close socket function, maybe extending the exception with an error code?

Because based on the errorcode i want to log some things and/or give feedback to the user, which isnt possible at this time(parsing the exception message does not seem to be a good idea)


Greets
Memnarch

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 16 Nov 2011 07:20

Thank you for the advice. We will investigate the possibility of adding such functionality in one of the next SecureBridge builds.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 16 Jan 2012 12:00

Begining from SecureBridge version 4.1.2 you can know the error code returned by WSAGetLastError by handling the SocketException exception using the SocketException.ErrorCode property.

Post Reply