By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Communicate Between 2 PC with ethernet

P: 10
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
Apr 13 '07 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
This questions is being moved to the Visual Basic forum.

ADMIN
Apr 13 '07 #2

Dököll
Expert 100+
P: 2,364
Greetings!

Get a load of this tutorial:

http://www.phoenixbit.com/site/tutor...ljL3dpbnNvY2sx

Hopefully this can help you tackle your task...

Dököll
Apr 15 '07 #3

Dököll
Expert 100+
P: 2,364
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:


Expand|Select|Wrap|Line Numbers
  1.  
  2. Try
  3.  
  4.                 stn(num).socket = New Socket(Sockets.AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
  5.  
  6.  
  7.                 Dim TargetAddr As New IPAddress(&H102A8C0)
  8.                 Dim localPoint As IPEndPoint = New IPEndPoint(&H1002A8C0, 10)
  9.                 Dim remotePoint As IPEndPoint = New IPEndPoint(&H102A8C0, 10)
  10.  
  11.                 stn(num).socket.Bind(localPoint)
  12.  
  13.                 stn(num).socket.Connect(remotePoint)
  14.  
  15.                 stn(num).NetRecvTimer.Interval = 200
  16.                 stn(num).NetRecvTimer.Enabled = True
  17.  
  18.             Catch sockError As SocketException
  19.                                 MsgBox(sockError.Message)
  20.             Catch appError As Exception
  21.                                 MsgBox(appError.Message)
  22.             Finally
  23.                 Beep()
  24.             End Try
  25.  
  26.  
Added code tags to your message for better clarity...
Apr 15 '07 #4

P: 10
hi,
Thank for the rely but i need it in .net framework
i am using visual studio 2005 and VB6 dun seem to work with it.



Greetings!

Get a load of this tutorial:

http://www.phoenixbit.com/site/tutor...ljL3dpbnNvY2sx

Hopefully this can help you tackle your task...

Dököll
Apr 18 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.