bueno aver agamos las cosas sensillas
Cliente dos textbox y un command1
Servidor dos textbox y un command1
Eso es un código bien basico, solo tenes que cambiar la IP y probarlo te tiene que funcionar, una ves que verificaste que esto funciona le agreas las demas boludeces.
Cliente dos textbox y un command1
Código [Seleccionar]
Option Explicit
Dim WithEvents Client As CSocketMaster
Private Sub Client_CloseSck()
Me.Caption = "Desconectado"
End Sub
Private Sub Client_Connect()
Me.Caption = "Conectado"
End Sub
Private Sub Client_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)
MsgBox Err.Description
End Sub
Private Sub Command1_Click()
Client.SendData Text2
End Sub
Private Sub Form_Load()
Dim IP As String
IP = "10.0.0.3" 'aqui deve ir la ip publica
Set Client = New CSocketMaster
Client.Connect IP, "100"
End Sub
Private Sub Client_ConnectionRequest(ByVal requestID As Long)
Client.CloseSck
Client.Accept requestID
End Sub
Private Sub Client_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Client.GetData data
Text1.Text = Text1.Text + data + vbCrLf
End Sub
Servidor dos textbox y un command1
Código [Seleccionar]
Option Explicit
Dim WithEvents Server As CSocketMaster
Private Sub Command1_Click()
Server.SendData Text2
End Sub
Private Sub Form_Load()
Set Server = New CSocketMaster
Server.LocalPort = 100
Server.Listen
End Sub
Private Sub Server_CloseSck()
Me.Caption = "Desconectado"
End Sub
Private Sub Server_ConnectionRequest(ByVal requestID As Long)
Server.CloseSck
Server.Accept requestID
Me.Caption = "Conectado"
End Sub
Private Sub Server_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Server.GetData data
Text1.Text = Text1.Text + data + vbCrLf
End Sub
Private Sub Server_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)
MsgBox Err.Description
End Sub
Eso es un código bien basico, solo tenes que cambiar la IP y probarlo te tiene que funcionar, una ves que verificaste que esto funciona le agreas las demas boludeces.