Add both controls, don't set any property at design-time and try this echo server i.e. just repeats what is sent to it
cheers,Code:Option Explicit Private Sub Form_Load() With wskServer .Protocol = sckTCPProtocol .RemotePort = 0 .LocalPort = 51393 .Listen End With Debug.Print "TCP Server started..." Debug.Print "- Host: " & wskServer.LocalHostName Debug.Print "- IP: " & wskServer.LocalIP Debug.Print "- Port: " & wskServer.LocalPort Debug.Print "=============================" End Sub Private Sub wskServer_ConnectionRequest(ByVal requestID As Long) If wskAccepted.State <> sckClosed Then wskAccepted.Close wskAccepted_Close End If wskAccepted.Accept requestID wskAccepted_Connect End Sub Private Sub wskAccepted_Connect() Debug.Print "Client connected from IP: " & wskAccepted.RemoteHostIP & ", Port: " & wskAccepted.RemotePort End Sub Private Sub wskAccepted_Close() Debug.Print "Client disconnected from IP: " & wskAccepted.RemoteHostIP & ", Port: " & wskAccepted.RemotePort End Sub Private Sub wskAccepted_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 "Error " & Number & ": " & Description End Sub Private Sub wskAccepted_DataArrival(ByVal bytesTotal As Long) Dim baBuffer() As Byte wskAccepted.GetData baBuffer wskAccepted.SendData baBuffer End Sub
</wqw>




Reply With Quote
