Código:
El problema esta aqui:
Private Sub Command2_Click()
Winsock1.Close
Winsock1.LocalPort = 9900
Winsock1.Listen
Text1.SelStart = Len(Text1.Text)
Text1.Text = Text1.Text & "*** Servidor encendido." & vbCrLf
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Command3_Click()
Winsock1.Close
Text1.SelStart = Len(Text1.Text)
Text1.Text = Text1.Text & "*** Servidor Cerrado." & vbCrLf
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Winsock1_Close()
Text1.SelStart = Len(Text1.Text)
Text1.Text = Text1.Text & "*** Client BYEBYE." & vbCrLf
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
'cerramos previamente el socket
Winsock1.Close
'aceptamos la conexion
Winsock1.Accept requestID
'desplegamos un mensaje en la ventana
Text1.SelStart = Len(Text1.Text)
Text1.Text = Text1.Text & "*** Cliente enter, welcome!" & vbCrLf
Winsock1.SendData "Welcome" & vbCrLf
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Buffer As String '
Winsock1.GetData Buffer
If Buffer = "110" Then
Winsock1.SendData "Usuario:" & vbCrLf
End If
End Sub
Private Sub Winsock1_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)
'cerramos la conexion
Winsock1.Close
'mostramos informacion sobre el error
MsgBox "Error numero " & Number & ": " & Description, vbCritical
End Sub
Código:
No se envia ningun dato al clienteIf Buffer = "110" Then Winsock1.SendData "Usuario:" & vbCrLf End If
La variable buffer este definida, porque si pongo esto:
Código:
si que me pone el mensaje que envia el clientemsgbox buffer, vbcritical
El problema pampoco este en
Código:
Porque si lo pongo por separado envia los datos al cliente perfectamente.Winsock1.SendData "Usuario:" & vbCrLf
Entonces, cual es el problema?


Gracias y un saludo
)




Este tema le ha gustado a 1 personas