473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Communicate Between 2 PC with ethernet

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
4 3245
MMcCarthy
14,534 Expert Mod 8TB
This questions is being moved to the Visual Basic forum.

ADMIN
Apr 13 '07 #2
Dököll
2,364 Expert 2GB
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
2,364 Expert 2GB
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
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

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

Similar topics

7
by: Chaser | last post by:
Hi folks, Just wondering if anyone knows where I can find modules for NI-488.2 GPIB and for a generic ethercard? Thanks.
2
by: kamarudin samsudin | last post by:
Hi all, Im new to linux and very very new to python. But i have to write a program to communicate with a devide. The device will send a data after i send something to it. Any suggestion and...
9
by: polkid | last post by:
I need some guidance here please! I need to write code to talk from a PC to a DAQ type of thing, and have there be a stream of data back and forth between them. I don't want to use TCP because I...
5
by: MLH | last post by:
Well one thing I've wanted to do is be able to PHYSICALLY connect and dis- connect a PC's xBASE-T connection via program control. The idea is... Instead of plugging your standard R-J45...
0
by: TonyJ | last post by:
Hello! We have a pc running a form application. If I push some buttons in this application I want to send some commands to a scale which is connected to a specific IP address. When I sent a...
13
by: KiwiGenie | last post by:
I am trying to connect to the internet using a USB Ethernet adapter. It installs but won't connect to my dsl modem. The ethernet light on the modem doesn't even light up, though the same cable works...
11
by: gustavo.samour | last post by:
Hi, I am writing a very basic raw ethernet sniffer based on what I found in Andreas Schaufler's raw ethernet article: http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html I'm trying...
1
by: kavok | last post by:
I am writing a software that needs to sniff packets in the network (raw ethernet) and also, with another thread send regular UDP packets with the common socket API's. However, when the RAW...
4
by: Hero Doug | last post by:
A friennd and I were talking about OS development last night and a few questions were raised that need some clarification. I did the usual search and it turned up the usual garbage, so I'm hoping...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.