I am required to send and recevied data between 2 PC through ethernet port. i have used a cross cable to connect both PC and i fix IP address with the following:
PC1: 192.168.1.1
PC2: 192.168.1.2
I am able to ping one another in the window DOS. I received socket error when i try to connet to the remote point. Pls help to solve the problem.
And below is my following code:
Try
stn(num).socket = New Socket(Sockets.AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim TargetAddr As New IPAddress(&H102A8C0)
Dim localPoint As IPEndPoint = New IPEndPoint(&H1002A8C0, 10)
Dim remotePoint As IPEndPoint = New IPEndPoint(&H102A8C0, 10)
stn(num).socket.Bind(localPoint)
stn(num).socket.Connect(remotePoint)
stn(num).NetRecvTimer.Interval = 200
stn(num).NetRecvTimer.Enabled = True
Catch sockError As SocketException
MsgBox(sockError.Message)
Catch appError As Exception
MsgBox(appError.Message)
Finally
Beep()
End Try