UDP Working!
Posted: Fri Sep 19, 2008 7:07 pm
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
The code that runs to send the UDP packet to my (homemade) UDP server is as simple as:
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
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
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
);
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