NETWORK Programming||Where to start
NETWORK Programming||Where to start
I want to learn network programming at low-level for implementing networking in my OS...So where to learn low-level network programming..any suggest/book suggestion are welcome
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: NETWORK Programming||Where to start
If you're really out for a book, I have an old edition of this which covers pretty much all the theory and has a better index than the average google query. You just have to read it in the less-logical back-to-front order.
What you will not find in any book is how to write a device driver for any network card. So what you will need to do is grab an emulator (choice depending on debuggability, bochs has the most options but is more difficult to set up) and wireshark, check that the virtual network works and is sniffable (try an existing os), then dive into the documentation of the emu's network card, and then get cranking some code to have it initially send anything random, then send whatever packet you found in the book.
What you will not find in any book is how to write a device driver for any network card. So what you will need to do is grab an emulator (choice depending on debuggability, bochs has the most options but is more difficult to set up) and wireshark, check that the virtual network works and is sniffable (try an existing os), then dive into the documentation of the emu's network card, and then get cranking some code to have it initially send anything random, then send whatever packet you found in the book.
Re: NETWORK Programming||Where to start
I know the theory I want to understand the implementation or how its implemented.....other OS[on frontend] use socket approach but I want to know how sock is implemented...or how..etc..how OS communicate using modem/ether ports etc...
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: NETWORK Programming||Where to start
You might be interested in this classic (official website here). It doesn't cover any modern protocols but it is more than enough to get you started.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: NETWORK Programming||Where to start
It's on UNix tcp/ip implementation and I want a low-lev stuff or in other words 50000 feets below that is Ground-UP
Re: NETWORK Programming||Where to start
I want to learn net-implementaion
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: NETWORK Programming||Where to start
So... drivers? Like Combuster said, grab the specification for the NIC you wish to write a driver for.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: NETWORK Programming||Where to start
You have to walk before you can run. Forget all about protocols, TCP/IP, etc. for the time being and just get a driver for your NIC working. For starters get it receiving data (if you do that, writing data should be easy enough).
Once you have that working you can worry about the higher levels of the networking model.
Once you have that working you can worry about the higher levels of the networking model.
Re: NETWORK Programming||Where to start
So I have to write for different NIC different for a particular NIC isn't there is any standard for NIC....
Thankyou to all for paying your precious time to my problem
Thankyou to all for paying your precious time to my problem
Re: NETWORK Programming||Where to start
Drivers can share small chunks but there is no one driver to rule them all.
Re: NETWORK Programming||Where to start
I wanna see others code first as an example to understand I mean interfacing with NIC card...can anybody help
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: NETWORK Programming||Where to start
There are a few people here who have written networking stacks, myself among them.
Here's the source for my RTL8139 (a classic 10/100 chip, and still very common) driver. https://github.com/thepowersgang/acess2 ... /rtl8139.c
Here's the source for my RTL8139 (a classic 10/100 chip, and still very common) driver. https://github.com/thepowersgang/acess2 ... /rtl8139.c
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: NETWORK Programming||Where to start
@thepowerersgang
Sir,it means we have to write different drvs for different NICS...So I wanna know how to detect NIC Card model and run a particular drv for it
Sir,it means we have to write different drvs for different NICS...So I wanna know how to detect NIC Card model and run a particular drv for it
Re: NETWORK Programming||Where to start
I'm not convinced that you understand what you are trying to do; there is no simple step-by-step answer to your question.
Detecting hardware is a universal question with an OS. Most people start by targetting the particular hardware they have (either real or virtual). Beyond that you have to scan the PCI and USB buses to see what hardware is there.
As for writing the driver, that is different for each individual hardware component. The Wiki here gives outlines for some hardware, but you really need to get hold of the manufacturers technical manual. If you want complete source code showing how to detect hardware and communicate with it, this is available for just about any device you can think of. It's called the "Linux Source Code". But, beware; it is not easy reading. Writing device drivers, particularly for a NIC is not an easy task.
I think you need to do a lot more reading before you are ready to support a NIC in your own OS.
Detecting hardware is a universal question with an OS. Most people start by targetting the particular hardware they have (either real or virtual). Beyond that you have to scan the PCI and USB buses to see what hardware is there.
As for writing the driver, that is different for each individual hardware component. The Wiki here gives outlines for some hardware, but you really need to get hold of the manufacturers technical manual. If you want complete source code showing how to detect hardware and communicate with it, this is available for just about any device you can think of. It's called the "Linux Source Code". But, beware; it is not easy reading. Writing device drivers, particularly for a NIC is not an easy task.
I think you need to do a lot more reading before you are ready to support a NIC in your own OS.