Information Technology Reference
In-Depth Information
Figure 24.13 Server form
24.10.2 Creating a client
The client must actively seek a connection. To create a client, do the following:
1 Add a new form to the project, and name it myClient.
2 Change the caption of the form to 'Client Application'.
3 Add a WinSock control to the form and name it myTCPClient.
4 Add two TextBox controls to the form. Name the first SendTextData, and the second
ShowText.
5 Draw a CommandButton control on the form and name it cmdConnect.
6 Change the caption of the CommandButton control to Connect.
7 Add the code given below to the form.
Private Sub Form_Load()
' In this case it will connect to 146.176.151.130
' change this to the local IP address or DNS of the local computer
myTCPClient.RemoteHost = " 146.176.151.130 "
myTCPClient.RemotePort = 1001
End Sub
Private Sub cmdConnect_Click()
' Connect to the server
myTCPClient.Connect
End Sub
Private Sub SendTextData_Change()
tcpClient.SendData txtSend.Text
Search WWH ::




Custom Search