| This is the easiset bit of Winsock programming. All you have to do, is set the Winsock properties, then call the .Connect method. Mswinsck.ocx will do the rest, and alert you to the success of the method via one of two events - Winsock_Connect() and Winsock_Error(). The code looks like this: Private Sub cmdConnect_Click() ' set up the Winsock properties ' and start the connect sequence Winsock.RemoteHost = "127.0.0.1" Winsock.RemotePort = "12345" Winsock.Connect End Sub Private Sub Winsock_Connect() ' we're connected MsgBox "Connected to: " & Winsock.RemoteHostIP End Sub Private Sub sckMain_Error(ByVal Number As Integer, Description As String, _ ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, _ ByVal HelpContext As Long, CancelDisplay As Boolean) ' alert the user to the error MsgBox "Error: " & Description End Sub 'Thats it! Easy. |
Make a connection |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design