The Winsock control let you connect to a remote machine and exchange data using DCP or TCP.
In order to connect you must supply a Protocol type.
(For the example I assume that you have called the control Winsock1)
Winsock1.Protocol = sckTCPProtocol (or sckUDPProtocol)
You must decide which computer will be the server and which is the client
Sub Form1_Init
'(Server Side)
Winsock1.LocalPort
Winsock1.Listen
End Sub
-----------------
Sub Form1_Init
'(Client side)
'To connect to a remote computer you must now its IP or its name
Winsock1.RemoteHost = "Remote Computer Name"
Winsock1.RemotePort = 1001
End Sub
Private Sub Command1_Click
'Command button to connect to the server
Winsock1.Connect
End Sub
The Winsock control has a method called Connection_Request where you normally have to accept the connection requested:
Private Sub Winsock1_ConnectionRequest(...)
End Sub
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement