Funny liitle project, wrote UDP stack, with netcat on top: jppecat

Wanted to test a Microchip ENC28J60 ethernet controller chip. That chip is 3.3V and 5 V tolerant. So decided to test on the PC par port first. Ended up writing a complete UDP ARP subsystem in C, this will add ethernet for next to nothing to anything that has an 8 bits port.

formatting link

Those who know netcat will see I wrote a netcat clone on top of the UDP layer.

Reply to
Jan Panteltje
Loading thread data ...

That's kind neat, Jan. What kind of throughput are you getting?

Reply to
Joel Koltner

You could have used uIP. That would have saved you a lot of work. I managed to run uIP on top of the libpcap libraries to test embedded IP appliances on a PC.

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
nico@nctdevpuntnl (punt=.)
--------------------------------------------------------------
Reply to
Nico Coesel

On a sunny day (Mon, 3 May 2010 13:11:12 -0700) it happened "Joel Koltner" wrote in :

Thank you. It is not very fast, have not really measured it, but you can play mp3 via it :-) One thing, if you test this version, use the -v flag, I accidently have a return statement within a verbose print, so without the -v it will not return and throw an error. And verbose slows it down of course. The real speed is set by the hardware that drives it, bit banging the printer port is not fast. There are absolutely more bugs, this is version 0.1, just got it working. The main idea is to use it for telemetry, say a packet at the time. If there is some time between packets (say a few ms) then everything should work great. Best is to watch the website for new versions.

Reply to
Jan Panteltje

On a sunny day (Mon, 03 May 2010 20:42:19 GMT) it happened snipped-for-privacy@puntnl.niks (Nico Coesel) wrote in :

No idea what uIP is, this uses no libraries, and is 100% copyright mine. It is a powerful building block for further projects, as now for ethernet connectivity you no longer need an OS! John Larking will like that idea :-) Just add any protocol you like on top of it for telemetry, dream up your won, and then that is rights free too. And it is good to know exactly the innards of ethernet, I know more about it now then before I started, that is also the fun part. Writing code for UDP was new to me, I already had a go at TCP many many years ago for packet radio.. But that is an other story.

Reply to
Jan Panteltje

port.

That is exactly what uIP is about (also free to use for any purpose). Why re-invent the wheel? Libpcap is just handy to test your application on a PC platform. Libpcap actually makes a raw connection to the ethernet card like your own application has its own network card.

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
nico@nctdevpuntnl (punt=.)
--------------------------------------------------------------
Reply to
Nico Coesel

On a sunny day (Tue, 04 May 2010 00:16:37 GMT) it happened snipped-for-privacy@puntnl.niks (Nico Coesel) wrote in :

OK, so maybe same idea, that leaves you to write a driver for the ENC28J60. Once you have the driver, the layers on top of that, in a OS independent way, are a natural thing to also write. I have made millions (no kidding) for my bosses in the long ago past by being able to write from the 'silicon level upward' anything that is not bloat, does exactly what you want, The understanding of the matter is the reward, and the power it gives you is priceless. I have seen too many libraries used, from kde bloat to SDL, to whatever, to solve problems you can solve with just a few hundred lines of code if you know the details. I am not critisizing anybody for using libraries, I use those a lot, but I want *me personally* to know every gory detail of the stuff I am using, for example so I can do everything everybody else cannot do. This jppecat is cute, what it reads from stdin, comes out at the destination IP, and what comes from the destination IP goes to stdout. Of course with the Linux OS code 'main'. There are some routines in it, like that in 'listen' and send_udp_data() that can be called from any application, OS or not. It is just fun to write, only limited by the imagination. If you type at one end (10.0.0.150): netcat -l -p 1024 and at the other end jppecat -i 10.0.0.150 -p 1024 -v Anything you type shows up at 10.0.0.150 hehe I have send quite long files, and then did a diff with the originals, zero errors. Amazes me, as I have seen lots of errors with UDP streaming in the past. There is more stuff that needs to be added, this is only version 0.1, at least it is a decent driver for the ENC28J60.

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.