Raw Ethernet communication

For issues with communication ports, protocols, etc.
mikesixes
Posts: 2
Joined: Mar 19, 2016 20:35

Raw Ethernet communication

Postby mikesixes » Mar 21, 2016 1:18

I'm looking at converting a DOS application to Linux. The program sends and receives a 64-byte ethernet packet between the PC and a machine controller every millisecond while the machine is in operation. This is not a network operation. The PC and the machine are just using the ethernet cable as a super-fast serial port. There is no protocol except the ethernet standard. How does one handle raw ethernet packets in FreeBasic? The DOS program uses a packet driver, but no such thing appears to exist in Linux, and FB doesn't appear to use sockets, the way Linux C does.
MrSwiss
Posts: 2024
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Raw Ethernet communication

Postby MrSwiss » Mar 21, 2016 9:33

@mikesixes,

wellcome to the Forum.

see: Networking Question Example Code
SNC: Simple Network Connection by D.J.Peters ...
last updated: yesterday (2016-03-20):
download: SimpleNetworkConnection.zip
use: Server.bas / Client.bas from the "Networking Question - Thread" to Start with.

NO WARRANTIES whether it can do it, at the Speed you require (1mS) ... (LIN/WIN = multitasking OS vs. DOS = One Task!)
AFAIK, Ethernet-Packet-Size-Max. = 1500 Bytes (about 1K = 1024 Bytes Pay-Load, the Rest is Headers etc.),
therefore with 64 Bytes, you should manage with a single Packet.
This, before Fragmentation starts (at a Hardware Level, Bridges, Routers, Switches ...).

Maybe on later OS, this Size has been increased ... (not certain whether this applies to the HW too)
Dinosaur
Posts: 975
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Re: Raw Ethernet communication

Postby Dinosaur » Mar 21, 2016 13:26

Hi All

Mikesixes, I have been there and done that, and I would not recommend moving away from Dos
if the millisecond timing is important.

I used a dedicated master computer to communicate to up to 8 slaves with Ethernet in Dos 20 years ago,
both running my software and even though operating systems and cpu speeds have multiplied, you will not get that performance reliably
unless you install a "True" real time Linux system.

You will spend the rest of your days chasing why sometimes it takes 20 msec.

Just my opinion.

Regards
mikesixes
Posts: 2
Joined: Mar 19, 2016 20:35

Re: Raw Ethernet communication

Postby mikesixes » Mar 21, 2016 18:00

Mr. Swiss, Dinosaur-
Thank you for your replies. I'm looking forward to trying the SNC stuff out. Once I get the basic ability to access the ethernet port I'll see what I can do about the timing problem. I understand there's a realtime kernel for Ubuntu available, and maybe if I use that and shut down as many tasks as I can I'll be able to get the timing working. There won't be any issues with fragmentation or anything like that, because there are no routers or switches or anything in between the computer and the machine, they are just connected by a crossover cable. So it's not really a network application, and there isn't any tcp/ip handshaking or anything like that. In fact, the 2 units don't even use their MAC addresses to address each other. They're both just set up to accept broadcast packets and they both transmit their packets to the broadcast address.
I wouldn't even be looking to get away from DOS, except that it's getting hard to find DOS packet drivers for most of the ethernet cards available these days. You can use a NDIS driver with a packet driver shim, but that tends to eat up a lot of precious DOS memory. If there's an OS available that gives DOS-like access to the computer hardware and has driver support for modern devices I'd love to hear about it.

Cheers,
Mikesixes
jdmcbride
Posts: 19
Joined: Aug 06, 2016 16:13

Re: Raw Ethernet communication

Postby jdmcbride » Aug 28, 2016 18:39

Howdy,

Just trying to be helpful here. Have you been on any of the HamRadio websites? Those guys do a lot of communications via packet radio. maybe someone has already developed the wheel you need.
jdmcbride
Posts: 19
Joined: Aug 06, 2016 16:13

Re: Raw Ethernet communication

Postby jdmcbride » Aug 28, 2016 18:47

A google search for "raw ethernet communications" turns up a lot of hits and interesting information.

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest