Hello Guys,
Please bare with me with this as I am somewhat new to using the Winsock control with VB6.
The situation is this,
The requirement is that I use UDP and not TCP
I have an application running on a computer which we will call ComputerA that needs to listen for data coming from another computer which we will call ComputerB. The application on ComputerA will listen for this data and once received, then it needs to send data to ComputerB.
Since this application needs to act as a client for receiving data and a server for sending data, I will be using two Winsock controls, one called ListenerClient (the receiver) and another called SenderServer (the sender).
I have on a Form the following:
1. A button called Receive with the following code behind it:
ListenerClient.Close
ListenerClient.Protocol = sckUDPProtocol
ListenerClient.Bind 2727
The code for the DataArrival event is as follows:
Private Sub ListenerClient_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
ListenerClient.GetData sData, vbString
MsgBox sData
End Sub
2. A button called Send with the following code behind it:
SenderServer.Close
SenderServer.Protocol = sckUDPProtocol
SenderServer.RemoteHost = "XXX.XXX.X.XXX"
SenderServer.RemotePort = 2727
SenderServer.SendData "Message Sent From The Desktop Computer!"
Where XXX.XXX.X.XXX is the IP Address for the Laptop that I am using to send data to
Please note that I was concerned about specifying the actual IP address but can supply it is necessary.
As a test, I have been running the same application on my Desktop computer and my Laptop computer.
I am able to send data from the Desktop to the Laptop but not from the Laptop to the Desktop.
Am I doing everything correctly here, or is it just an IP address issue?
I hope I explained everything correctly
Thank you
Gary
What I have tried:
I have searched the internet but for items of interest but saw that it was written in c#