SOCK.GetError

Previous  Next

 

nError = SOCK.GetError( nSocket AS INTEGER ) AS INTEGER

 


 

Returns the socket error number when a SE_RN_OPERATION_FAILED error was raised.  You can use this to determine the exact cause of the error condition and take the appropriate action.  The include file MyBASIC2_SockLib.bis contains constants for the error codes.

 

Example:

 

ON ERROR GOTO _ERROR

 

nReceived = SOCK.Receive( nSocket, frame, nMarkers * 3 * 4, 10 )

 

_ERROR:

  IF SOCK.GetError( nSocket ) = WSAECONNRESET THEN

     PRINT "ERROR: Connection Lost.  Terminating Connection with Server",

     STOP 10054

  ENDIF

 

  RESUME NEXT