473,574 Members | 3,206 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C program to communicate over ethernet

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 dont need all those headers and whatnot, that's just
extra information. This is just between 2 machines, no routing needed.

So where do I look? How do I start? Everything I find talks about IP
addresses and stuff. I just need to stream bytes over ethernet.

(A side note, is sockets() just a TCP thing?)

Thanks!

Wade Polk

Jul 28 '06 #1
9 7808
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 dont need all those headers and whatnot, that's just
extra information. This is just between 2 machines, no routing needed.

So where do I look? How do I start? Everything I find talks about IP
addresses and stuff. I just need to stream bytes over ethernet.

(A side note, is sockets() just a TCP thing?)
I would strongly recommend using UDP or TCP to transport the data. In
all other cases you will end up with a lot of code that may not be
readily portable to other platforms.

Use socket APIs to write your program and it will be easily portable to
any platform.

--
VisualEther 1.0 - http://www.EventHelix.com/VisualEther
Visual protocol analysis and sequence diagram generation from Ethereal
Jul 29 '06 #2
"EventHelix.com " <ev********@gma il.comwrote:
# 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 dont need all those headers and whatnot, that's just
# extra information. This is just between 2 machines, no routing needed.
# >
# So where do I look? How do I start? Everything I find talks about IP
# addresses and stuff. I just need to stream bytes over ethernet.
# >
# (A side note, is sockets() just a TCP thing?)
#
# I would strongly recommend using UDP or TCP to transport the data. In
# all other cases you will end up with a lot of code that may not be
# readily portable to other platforms.
#
# Use socket APIs to write your program and it will be easily portable to
# any platform.

Even over 'simple' connections, there is so much overhead dealing
with unusual conditions, synchronisation , bufferring, etc that you
get for free if you use TCP. Unless you really know what you're
doing or dealing with real strange system, you are far better off
learning the existing library instead of writing your own.

Besides the TCP interfaces your system might provide, there are
other libraries like the Tcl C API which are even easier to use
and more portable.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
A bunch of savages in this town.
Jul 29 '06 #3
Thanks! I guess I just didnt want to use TCP because the program
doesn't need to be portable. It's going to be written to work between
two computers and no others ever. But I'll take your advice and write
it using TCP and see how it goes.

Jul 31 '06 #4
po****@gmail.co m wrote:
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 dont need all those headers and whatnot, that's just
extra information. This is just between 2 machines, no routing needed.
UDP?

Failing that you can also try IPX. It has no routing.
So where do I look? How do I start? Everything I find talks about IP
addresses and stuff. I just need to stream bytes over ethernet.
Um, you could send broadcast UDP packets and listen on 0.0.0.0
(A side note, is sockets() just a TCP thing?)
No. In Linux/BSD you can use the sockets API to deal with raw IP, raw
802.3, raw whatever. YMMV as the lesser portable methods are less
documented.

Tom

Jul 31 '06 #5
In article <11************ **********@s13g 2000cwa.googleg roups.com>,
EventHelix.com <ev********@gma il.comwrote:
>I would strongly recommend using UDP or TCP to transport the data. In
all other cases you will end up with a lot of code that may not be
readily portable to other platforms.
True.

>Use socket APIs to write your program and it will be easily portable to
any platform.
False though.

Readily portable to "other platforms" != "portable to any platform".
Sockets are not universal, and are not POSIX compliant on at least
one major popular operating system.

Using sockets is a lot better than rolling your own, which is unlikely
to get you to very many platforms. But no matter which API you use,
there will be some platform that it won't work on, even if said platform
has some kind of ethernet communications.
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Jul 31 '06 #6
po****@gmail.co m wrote:
Thanks! I guess I just didnt want to use TCP because the program
doesn't need to be portable. It's going to be written to work between
two computers and no others ever. But I'll take your advice and write
it using TCP and see how it goes.
If you continue networking, learning TCP will prove useful. Doing it
some other way might be interesting but not likely useful in the future.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 31 '06 #7

Tom St Denis wrote:
Failing that you can also try IPX. It has no routing.

While seriously OT...

Since when? IPX has been routable since it was derived from XNS 20+
years ago. Admittedly routing was not a standard feature of 1.x
versions of NetWare, but was certainly part of 2.0a (circa 1986), and
IPX routing has been available in numerous non-Novell products.

Aug 1 '06 #8

ro***********@y ahoo.com wrote:
Tom St Denis wrote:
Failing that you can also try IPX. It has no routing.


While seriously OT...

Since when? IPX has been routable since it was derived from XNS 20+
years ago. Admittedly routing was not a standard feature of 1.x
versions of NetWare, but was certainly part of 2.0a (circa 1986), and
IPX routing has been available in numerous non-Novell products.
IPX basically just used the MAC addresses IIRC. It was like UDP where
you had a port which identified the service.

MAC addresses are not routable because they are not hiearchical. Sure
you can manually map MAC addresses to given ports on a switch (for
instance, switches do this automatically as it discovers source
addresses) but it isn't scalable.

If there was any routing in IPX it was totally manual and host based
instead of network based like IP.

Tom

Aug 1 '06 #9

Tom St Denis wrote:
ro***********@y ahoo.com wrote:
Tom St Denis wrote:
Failing that you can also try IPX. It has no routing.

While seriously OT...

Since when? IPX has been routable since it was derived from XNS 20+
years ago. Admittedly routing was not a standard feature of 1.x
versions of NetWare, but was certainly part of 2.0a (circa 1986), and
IPX routing has been available in numerous non-Novell products.

IPX basically just used the MAC addresses IIRC. It was like UDP where
you had a port which identified the service.

MAC addresses are not routable because they are not hiearchical. Sure
you can manually map MAC addresses to given ports on a switch (for
instance, switches do this automatically as it discovers source
addresses) but it isn't scalable.

If there was any routing in IPX it was totally manual and host based
instead of network based like IP.

No, IPX used a two part address, a 32 bit network number and a 48-bit
host number (plus a 16 bit port). On LANs with Ethernet-style MACs,
the host number was just assigned to the MAC, although in some (rare)
circumstances a manual assignment was used. In short, this was roughly
equivalent to an 80 bit "IP" address with a fixed "/32" subnet mask.

Non-routing machines normally required no address configuration (beyond
what the LAN hardware required - for example Arcnet would require that
you set the 8-bit "MAC" address on each card, either in hardware or
software). Non-routing hosts would learn their network number from a
router on that LAN (a particular broadcast query). Routers, of course,
*did* have to be configured with the correct network number on each
NIC.

Novell eventually set up a registry of network number assignments,
which assigned globally unique network number ranges (IOW,
"subnets" of the network number).

FWIW, a minor variation of RIP was the routing protocol of choice for
early XNS and IPX implementations , although Novell eventually migrated
to an OSPF-like link-state protocol (NLSP) somewhere in the NetWare 3.x
days.

Aug 1 '06 #10

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

Similar topics

7
3096
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
2781
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 help. Maybe something where i can start it. many thanx.
1
1551
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
5
3083
by: Tyler | last post by:
Hi ppl, I know it's forbidden to mention Java in this newsgroup but I've been presented with a problem which requires that my C++ program communicate with another java program. What is the best,simplest and quickest way to go about this? I was thinking, I could have my C++ program write data to a file and then my Java program pick it...
3
2547
by: Simon | last post by:
Hi everyone, I'd quite like to create a small application that could listen on a port and take a copy of any communications going in or out. The end goal is to be able to offer statistics and stuff regarding the packets, and also to join them up and allow for easy reading of the packets and headers etc. The question is, how is it done?
3
1920
by: Bob Greschke | last post by:
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...
0
1485
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 command I also receive an answer from the scale. I want to communicate with the scale using TCP or UDP. The commands that can be sent to the scale are...
1
3367
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the src ip, dst ip, src port, dst port. Should I run this program as a Daemon? If so, how do I do that? I would appreciate your response.
1
12111
by: AngreGanon | last post by:
Hi all~ I've written a network program in C. This program catputures ARP request packet and reply wrong ARP packet. Hi. I've written a small program to learn to write in C. But unfortunately the output is all jumbled up and not nice Caputuring is ok, but couldn't send ARP packet. What's wrong? ( using 2PC, this program run in Linux and...
0
7764
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...
1
7863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8140
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...
0
6514
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5336
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...
0
3776
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...
1
2282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.