UDP Working!

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

UDP Working!

Post by pcmattman »

Hi everyone,

Just posting to show that I now have UDP working. This means I now start coding TCP into my system, after which I'll be even more excited :P

The code that runs to send the UDP packet to my (homemade) UDP server is as simple as:

Code: Select all

	Network::Udp::Send(
		0,
		"Hello world from NetStack - the OS I wrote to learn how to write a network stack!",
		strlen("Hello world from NetStack - the OS I wrote to learn how to write a network stack!") + 1,
		inetAddress(192, 168, 1, 110),
		12345
	);
In my system each protocol sits under the Network namespace, and provides an interface of at least "Receive" (which handles incoming packets). Functionality for sending packets is optional, and if it is implemented must use the other Network objects to create and send the packet.

As an example, things like ARP requests are abstracted by Network::Arp in order to provide an easy way to get MACs for IPs. Network::Arp::Receive is called by Ethernet::Receive (which is called by the driver) when the system finds that the Ethernet packet specifies ARP.

You can see a screenshot here: http://www.wikiforall.net/net_stack_udp.jpg (wide image so I'm not embedding it).

Now, I'm off to implement TCP :D
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: UDP Working!

Post by 01000101 »

awesome!
implementing network protocols is always exciting.

have you implemented checksumming? or have you left that out due to UDP not requiring it?
Also, have you tested this on real hardware or through BOCHS ne2k emulation only?
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: UDP Working!

Post by pcmattman »

I use full checksumming (even though it's optional, it's useful for sending outside of the local network).

Unfortunately I've only tested on Bochs' emulation so far, although I do have an NE2K lying around ready for me to get around to finding a spare testbed system.
Post Reply