473,811 Members | 3,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two ethernet cards/networks (still)

There is a lot to stuff that seems to skirt around this issue (most of which
has to do with finding your IP address), but I can't find anything that
explains how to write a client that (in my case) needs to collect some
information from some equipment on a private network/Ethernet card, then
transmit that info on the other Ethernet card/"outside" network to another
program (which will put it into a db).

"binding to a specific address is almost never used for a client", sez
Foundations of Python Network Programming, but is that how it's done?? Each
card has a fixed IP address. It's on Windows at this time if that makes any
difference.

Thanks!

Bob
Sep 7 '06 #1
3 1934
Bob Greschke wrote:
There is a lot to stuff that seems to skirt around this issue (most of which
has to do with finding your IP address), but I can't find anything that
explains how to write a client that (in my case) needs to collect some
information from some equipment on a private network/Ethernet card, then
transmit that info on the other Ethernet card/"outside" network to another
program (which will put it into a db).

"binding to a specific address is almost never used for a client", sez
Foundations of Python Network Programming, but is that how it's done?? Each
card has a fixed IP address. It's on Windows at this time if that makes any
difference.
The reason that "binding to a specific address is almost never used for
a client" is because it's the server destination address that the
network layer will use to determine which interface is used to
communicate with a specific server host.

Suppose your network setup looks like this:
+-------------------+------------------------+ Network A
|
|
|
| 192.168.12.34/24
|
+--------+--------+
| |
| |
| YOUR HOST |
| |
| |
+--------+--------+
|
| 201.46.34.22/24
|
|
|
+-------------------+----------+-------------+ Network B
|
+
+--------+--------+
| router |
| to internet |
+-----------------+

If your client program tries to communicate with, say, 192.168.12.18
then by the IP network layer will automatically select network A as the
medium, since the destination is local to that network. If you then want
to communicate the results to 201.46.34.118 then network B will be used,
again because the destination is local to that network (its first 24
bits are the same as the first 24 bits of the destination).

In this case the router on network B will almost certainly be the
default route for the host, as it's the way to everywhere else.

This isn't really Python-related, so I hope it answers your question!

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 7 '06 #2

"Steve Holden" <st***@holdenwe b.comwrote in message
news:ma******** *************** **************@ python.org...
Bob Greschke wrote:
The reason that "binding to a specific address is almost never used for a
client" is because it's the server destination address that the network
layer will use to determine which interface is used to communicate with a
specific server host.

Suppose your network setup looks like this:
+-------------------+------------------------+ Network A
|
|
|
| 192.168.12.34/24
|
+--------+--------+
| |
| |
| YOUR HOST |
| |
| |
+--------+--------+
|
| 201.46.34.22/24
|
|
|
+-------------------+----------+-------------+ Network B
|
+
+--------+--------+
| router |
| to internet |
+-----------------+

If your client program tries to communicate with, say, 192.168.12.18 then
by the IP network layer will automatically select network A as the medium,
since the destination is local to that network. If you then want to
communicate the results to 201.46.34.118 then network B will be used,
again because the destination is local to that network (its first 24 bits
are the same as the first 24 bits of the destination).

In this case the router on network B will almost certainly be the default
route for the host, as it's the way to everywhere else.

This isn't really Python-related, so I hope it answers your question!

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
Nice explanation! Thanks! You mean I don't have to do anything special??
That sounds suspiciously easy. :)

To muddy the water a little the equipment I want to get info from (some
seismic digitizing/recording equipment) comes back to us from the field with
the IP addresses set to whatever that last user needed. What we do now is
put the unit(s) on the bench, connect them to the private network and use a
broadcast address (like 255.255.255.255 ) and a specific port number to query
and see who is connected. Then we (a program) can get in (login, basically)
and reset the all of the IPs to the same subnet to proceed with checkout,
calibration, etc. We have to disconnect from (or disable the card for) the
outside network when we do this discovery or else the program discovers all
of these instruments that we have running in the building (monitoring a
seismic pier, in people's offices, etc.). I'm guessing here we will still
need to do this? It's not a biggie, but finding a way to not have to do
this was what started this whole thing. Once the program knows which
instruments it found on the private network it doesn't matter. It will only
work on those ones.

Thanks!

Bob
Sep 10 '06 #3
Bob Greschke wrote:
"Steve Holden" <st***@holdenwe b.comwrote in message
news:ma******** *************** **************@ python.org...
>>Bob Greschke wrote:
The reason that "binding to a specific address is almost never used for a
client" is because it's the server destination address that the network
layer will use to determine which interface is used to communicate with a
specific server host.

Suppose your network setup looks like this:
+-------------------+------------------------+ Network A
|
|
|
| 192.168.12.34/24
|
+--------+--------+
| |
| |
| YOUR HOST |
| |
| |
+--------+--------+
|
| 201.46.34.22/24
|
|
|
+-------------------+----------+-------------+ Network B
|
+
+--------+--------+
| router |
| to internet |
+-----------------+

If your client program tries to communicate with, say, 192.168.12.18 then
by the IP network layer will automatically select network A as the medium,
since the destination is local to that network. If you then want to
communicate the results to 201.46.34.118 then network B will be used,
again because the destination is local to that network (its first 24 bits
are the same as the first 24 bits of the destination).

In this case the router on network B will almost certainly be the default
route for the host, as it's the way to everywhere else.

This isn't really Python-related, so I hope it answers your question!

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden


Nice explanation! Thanks! You mean I don't have to do anything special??
That sounds suspiciously easy. :)

To muddy the water a little the equipment I want to get info from (some
seismic digitizing/recording equipment) comes back to us from the field with
the IP addresses set to whatever that last user needed. What we do now is
put the unit(s) on the bench, connect them to the private network and use a
broadcast address (like 255.255.255.255 ) and a specific port number to query
and see who is connected. Then we (a program) can get in (login, basically)
and reset the all of the IPs to the same subnet to proceed with checkout,
calibration, etc. We have to disconnect from (or disable the card for) the
outside network when we do this discovery or else the program discovers all
of these instruments that we have running in the building (monitoring a
seismic pier, in people's offices, etc.). I'm guessing here we will still
need to do this? It's not a biggie, but finding a way to not have to do
this was what started this whole thing. Once the program knows which
instruments it found on the private network it doesn't matter. It will only
work on those ones.
Ah, so you want to do a limited broadcast over a single interface (the
one for the private network) to avoid having to disable the other
interface? That's a different kettle of fish.

I suspect you could do it by binding the local socket to a single
address, but I'd need to play around to get it right. Maybe someone else
has already done this?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3109
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.
1
1559
by: LkR299 | last post by:
I have a project with a PC and a microcontroller. I am trying to create a program on the PC to communicate with the microcontroller through ethernet ports. I am still deciding which language, eVc or VB6 or VB.net. also to get a little information on how to read and write throught the ethernet to the microcontroller. Thanks
3
1464
by: Ophir | last post by:
Hi all ! Are there any windows API to get information about ethernet cards installed on the computer? Tried to search msdn but came out short. I need to get all present networking cards including ADSL etc, display them to a user and ask him what card would he like to use. Later I need to bind a winsock to that card's IP.
1
1811
by: Ray Mitchell | last post by:
Hello, If I have several ethernet adaptors with different IP addresses on my system and do the following (or something similar to an arbitrary non-Internet IP address), how do I know or control which of those cards is being used? TcpClient tcpClientB = new TcpClient("www.contoso.com", 11000); Thanks, Ray Mitchell
8
11469
by: Edison Abarca Tapia | last post by:
Hi: I need change MAC(nic) Address. I help me pleaseeeee... thanks, Edison
1
2492
by: gnanapoongothai | last post by:
Hi I am into the project of processing data from ethernet cards at a fast rate and send the process data out. Byt i am struck with abt details of hoe to access the data from ethernet. i know NIC cards are there and you have connector. When programming in c in vc++ what port u use and some explanation abt how to get the data. Awaiting a reply from u all soon to clarify my query.
11
18808
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 to print the output of each ethernet frame in both hexadecimal and character representations. I'm new at network programming in C. Here's a code snippet:
1
4898
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 Ethernet sniffing is on, the socket API calls sending regular UDP packets don't work (although they report no error). Do any of you know why this happens? I'm using linux 2.4.20 (it has to be this version... don't ask me why). This is my code to...
0
853
by: Guy007 | last post by:
I need to draw large networks (Finite state automata, with nodes connected by directed edges). I am searching for some DLL or class that will help me draw these networks in c#. So far, I have used GLEE, but it is still very primitive. I would like to be able to assign an event handler to the nodes in the graph, so that when i click on them, something happens... Does something similar exist!? Or am I the only person who ever needed...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10393
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3871
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.