The information in this article applies to:
SYMPTOMSWhen using the Winsock Control in Visual Basic, setting the LocalPort property to a port value that is already in use on the local computer raises a Visual Basic Run-time error when the Connect or Bind method is called. The Run-time error is as follows: Normally this could be captured using the Error Event of the Winsock Control, but even when the Error event is present for the control, the Error event is never fired and the Run-time error message box is displayed. RESOLUTIONA valid workaround is to use Visual Basic's standard Error Handling mechanism to catch the error as illustrated in the following code snippet:
Simply use the On Error method around the Connect or Bind method of the Winsock Control to capture this error.
MORE INFORMATIONSteps to Reproduce Behavior
When this code is run the Winsock1_Error handler is never called even though a Winsock Control error has occurred. Using the work-around mentioned earlier causes Visual Basic's normal error handling to handle the error.
Additional query words:
Keywords : kbnetwork kbAPI kbCtrl kbSDKPlatform kbSDKWin32 kbVBp600 kbDSupport kbGrpNet |
Last Reviewed: November 30, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |