LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Ideas for network programming practice projects (C/C++) (https://www.linuxquestions.org/questions/programming-9/ideas-for-network-programming-practice-projects-c-c-4175669526/)

sirabhorn 02-13-2020 08:39 AM

Ideas for network programming practice projects (C/C++)
 
I'm looking ideas for network programming projects. My languages are C or C++ (possibly also Rust and ARM/x86-Assembly).

By "networks" I primarily mean the functioning of Internet's infrastructure (in contrast to the WWW) which can include protocols such as BGP, OSPF, IMCP, ARP, TCP, IP, MPLS, IS-IS, OPF... but I'm also eager to learn about LANs and ethernet and related protocols such as ARP.

Projects could be smaller or bigger, I'm not very experienced yet but I like challenges.

rtmistler 02-13-2020 09:18 AM

Obtain the IETF specifications for the various internet protocols and write your own implementations of them.

Start with writing your own network sniffer/decoder software. (Note about promiscuous mode for adapters, learn about it)

Michael Uplawski 02-14-2020 11:19 PM

I suggest a different approach than rtmistler. You will learn about how the Internet works “in real” by following his advice, which can be exactly what is needed to program cool software.

However, the moment that you seek to program stuff, as your OP insinuates, you probably wish to see your stuff at work; and maybe to see your stuff at work, at last.

So either before you commence the network sniffer, or after you accomplished that task.., or while you are at it, for a while, maybe do the usual “Hello world” by programming a simple chat-application. Do it right from the start and mark the frontier between the server-side- and the client-side routines, which remain part of the same program, in this case.., in whichever way suites you. I remember that it gave me a lot of “energy”, seeing my own messages displayed on a second machine, while Sean Walten was laying beside my keyboard.

And P.S.: Not knowing where you are in your studies of network protocols, it may or may not be necessary to follow rtmistler's advice anyway.

sirabhorn 03-06-2020 02:56 PM

Thanks so far...

Do you have any suggestions how those different protocols given in the first post (is something essential missing from there?) might compare in their importance? ...when the goal is to get hold of network essentials (especially the low level Internet, also some Ethernet).

Intuitively, it might be the case that TCP/IP implementation would be the first thing to achieve (after that sniffer). Not totally sure what kind of software does it mean in practice but maybe I'll get an idea when I start working on it.

SoftSprocket 03-06-2020 04:42 PM

Quote:

Originally Posted by sirabhorn (Post 6097882)
Thanks so far...

Do you have any suggestions how those different protocols given in the first post (is something essential missing from there?) might compare in their importance? ...when the goal is to get hold of network essentials (especially the low level Internet, also some Ethernet).

Intuitively, it might be the case that TCP/IP implementation would be the first thing to achieve (after that sniffer). Not totally sure what kind of software does it mean in practice but maybe I'll get an idea when I start working on it.

You might read about a TCP/IP implementation (i.e. Comers or Stephens or the Linux network stack) but you implementing it might not be the place to start (or finish for that matter). Network Programming in the UNIX Environment is an old but venerable place to begin understanding network programming. If memory serves, and it might not, there are two volumes one covers the protocols and the other covers the programming interfaces.

dugan 03-06-2020 07:01 PM

Quote:

Originally Posted by sirabhorn (Post 6089514)
I'm looking ideas for network programming projects.

MPD client.

sirabhorn 03-07-2020 04:38 AM

Quote:

Originally Posted by SoftSprocket (Post 6097898)
Network Programming in the UNIX Environment is an old but venerable place to begin understanding network programming. If memory serves, and it might not, there are two volumes one covers the protocols and the other covers the programming interfaces.

My experiences so far suggest that network programming tutorials should be rather recent. Ten or twenty years old code is not likely to work anymore and if it's about Unix rather than Linux specifically, that probably won't help.

(still looking for answers to my previous post)

SoftSprocket 03-07-2020 09:03 AM

Quote:

Originally Posted by sirabhorn (Post 6098010)
My experiences so far suggest that network programming tutorials should be rather recent. Ten or twenty years old code is not likely to work anymore and if it's about Unix rather than Linux specifically, that probably won't help.

(still looking for answers to my previous post)

You aren't asking about network programming. TCP/IP isn't something you program. It's a two protocols that form layers that you write programs on top of. You could write those layers but you will have to interface with the OS stack to do so and have a lot of knowledge and a lot of time. The fundamentals of network programming haven't changed and a random list of protocol acronyms is meaningless. There are things in older books that are no longer apropos but fundamentally the Berkeley Socket implementation hasn't changed. https://en.wikipedia.org/wiki/Berkeley_sockets If you want to be a network programmer you can either use languages that hide the details, and learn to use those correctly, or you can learn the details of how it is done in C.

If you are serious when you say "Intuitively, it might be the case that TCP/IP implementation would be the first thing to achieve (after that sniffer)." You will need to start with some old documents.
https://tools.ietf.org/html/rfc791
https://tools.ietf.org/html/rfc793
https://tools.ietf.org/html/rfc768

Here's some information on how linux interfaces with the network and programming apis interface with linux https://www.kernel.org/doc/html/late...ing/index.html

It doesn't hurt to know this stuff but it isn't necessary to now all the details to write network programs. Understanding what IP, TCP and UDP are is essential. In modern networks the protocols that make our applications work are written on top of these protocols.

Even "writing a sniffer" is a meaningless phrase. Sniffers either implement a kernel driver or use a library that does. One is a very advanced application, the other requires understanding of network packets but is fairly trivial to get started at. Sniffing packets won't help you much unless you understand what it is you see in the output.
https://www.tcpdump.org/

sirabhorn 03-07-2020 03:01 PM

Quote:

Originally Posted by SoftSprocket (Post 6098062)
You aren't asking about network programming. TCP/IP isn't something you program. It's a two protocols that form layers that you write programs on top of. You could write those layers but you will have to interface with the OS stack to do so and have a lot of knowledge and a lot of time.

So do you disagree with the first person who answered to this thread and say that I should not write implementations of these different protocols?

Or do you think I have got it wrong what implementation means?

So, what kind of practice projects you think a person should take in order to learn network programming?

rtmistler 03-07-2020 04:45 PM

I don't think it really should be a concern if different people have different suggestions, that's normal.

Instead you can look for a wide variety of source examples on the web and start with those, no matter which particular type of network programming interests you.

All those protocols you listed are already written, you can search for source of many of these along with their specs and learn as you review, modify, compile, and etc.

The key would be to start exploring.

SoftSprocket 03-07-2020 07:15 PM

Quote:

Originally Posted by sirabhorn (Post 6098183)
So do you disagree with the first person who answered to this thread and say that I should not write implementations of these different protocols?

Or do you think I have got it wrong what implementation means?

So, what kind of practice projects you think a person should take in order to learn network programming?

I think you misunderstood me. I think you should start at the beginning not the end.

Start with the basics - write a simple client/server - perhaps an echo server - and try to understand how and why it works. Add threading or process forking so the server can handle more then one connection. Create a communication protocol so the client/server can perform a useful function.

If your goal is to dive into the underlying protocols then read about them first because there is a lot to understand to make any sense of it.

sirabhorn 03-08-2020 05:27 AM

Quote:

Originally Posted by SoftSprocket (Post 6098265)
I think you misunderstood me. I think you should start at the beginning not the end.

Start with the basics - write a simple client/server - perhaps an echo server - and try to understand how and why it works. Add threading or process forking so the server can handle more then one connection. Create a communication protocol so the client/server can perform a useful function.

If your goal is to dive into the underlying protocols then read about them first because there is a lot to understand to make any sense of it.

It seems I failed to communicate a bit and I should have clearly describe at which point I'm currently standing. Basically, my intent was to ask where should I head at the point when I've already accomplished what you wrote here: what kind of projects would be a next step to deepen the understanding about (low-level) networking after the basic socket level stuff you describe has been done.

Learning the protocols at the most detailed level is not the goal itself for me but I assumed the good knowledge on these protocols is essential here. And the approach doesn't even need to focus strongly on protocols, I've just assumed they're pivotal.

So far I've been suggested to write implementations of essential network protocols. That's what I've been considering but other ideas are welcome as well.

SoftSprocket 03-08-2020 10:05 AM

Quote:

Originally Posted by sirabhorn (Post 6098342)
It seems I failed to communicate a bit and I should have clearly describe at which point I'm currently standing. Basically, my intent was to ask where should I head at the point when I've already accomplished what you wrote here: what kind of projects would be a next step to deepen the understanding about (low-level) networking after the basic socket level stuff you describe has been done.

Learning the protocols at the most detailed level is not the goal itself for me but I assumed the good knowledge on these protocols is essential here. And the approach doesn't even need to focus strongly on protocols, I've just assumed they're pivotal.

So far I've been suggested to write implementations of essential network protocols. That's what I've been considering but other ideas are welcome as well.

That's why I suggested reading as the next step.

The lowest level you can go in linux user space is to use raw sockets. To go lower means diving into the kernel. This is perfectly valid but not the best way to learn about the protocols since it is pretty easy to get lost in the weeds.

Your post says you are not very experienced. Implementing a user space protocol, if you haven't already, might be a better way to get experience then implementing a routing protocol. Just my 2c.

sirabhorn 03-08-2020 10:12 AM

Quote:

Originally Posted by SoftSprocket (Post 6098407)
Implementing a user space protocol, if you haven't already, might be a better way to get experience then implementing a routing protocol. Just my 2c.

Which are user space protocols? What kind of projects are you talking about?

SoftSprocket 03-08-2020 11:39 AM

Quote:

Originally Posted by sirabhorn (Post 6098409)
Which are user space protocols? What kind of projects are you talking about?

There are no shortage of them. Some of the classics from wikipedia: DHCP, HTTP, HTTPS, POP3, SMTP, FTP, IRC, Telnet, AMQP.
https://en.wikipedia.org/wiki/List_o...ols_(OSI_model)

In a previous job I spent a lot of time on SIP, SDP, RTSP, RTP, etc. Lots of challenges there (internet telephony).

If reading a protocol doesn't seem interesting then think of things you might want to reasonably communicate between computers and devise a means of your own to do it. i.e. write your own protocol.


All times are GMT -5. The time now is 07:11 PM.