I have write a simple Client/Server program, for multiple client within my home. But when I run the client program, It give me the following Error.
Run Time Error 40020!
My code is below, THanks For your help in advance!
VB Code:
Option Explicit Private Sub cmdClose_Click() Socket1.Close StatusBar1.Panels(1).Text = "Connection Closed" End Sub Private Sub cmdConnect_Click() If Socket1.State <> sckClosed Then Socket1.RemoteHost = "192.168.0.4" Socket1.RemotePort = 1007 Socket1.Connect txtSend.SetFocus StatusBar1.Panels(1).Width = 1000 StatusBar1.Panels(1).Text = "Connecting to server..." Else MsgBox "Error! Connection already exist, Please Close connection before Connect!" End If End Sub Private Sub Form_Load() Socket1.Connect End Sub Private Sub txtSend_KeyPress(KeyAscii As Integer) Static Last_Line_Feed As Long If Socket1.State <> sckConnected Then Dim NewLine As String If txtSend = vbNullString Then Last_Line_Feed = 0 If KeyAscii = 13 Then NewLine = Mid(txtSend, Last_Line_Feed + 1) Last_Line_Feed = txtSend.SelStart End If StatusBar1.Panels(1).Text = "Sending Data..." Socket1.SendData txtName.Text & " >" & NewLine DoEvents Else StatusBar1.Panels(1).Text = "Not Currently Connected!" End If End Sub Private Sub Socket1_DataArrival(ByVal bytesTotal As Long) Dim data As String Socket1.GetData data, vbString txtReceive.SelText = data End Sub Private Sub Socket1_SendComplete() StatusBar1.Panels(1).Text = "Complete Sending Process!" End Sub
The stops at [Socket1.RemoteHost = "192.168.0.4"]
anyone can help!!!![]()




Reply With Quote