HACKER Q&A
📣 rubicon33

Need a C Project / Goal


Hello -

I am interesting in C and sockets. I'd like to have a project or interesting goal to pursue that involves writing C with POSIX sockets, possibly streaming or even UDP.

Anyone have a suggestion? Maybe a good course online with hands on projects? I just need something I can sink my teeth into that feels relevant.


  👤 thesuperbigfrog Accepted Answer ✓
If you are looking for pratical projects, nanomsg and its successor, nng, might be worth checking out:

https://nanomsg.org/

https://nng.nanomsg.org/

If you are looking at understanding the concepts, I recommend two books:

1) UNIX Networking Programming by W. Richard Stevens et al. is a classic that covers network programming in C. Be sure to get the latest version (third edition, I think) for the best POSIX coverage

https://en.wikipedia.org/wiki/UNIX_Network_Programming

http://www.unpbook.com/

2) The Linux Programming Interface by Michael Kerrisk is a great, more modern, more generalized book for POSIX programming with C. It does not focus on network programming as much as UNIX Network Programming, but is still highly recommended.

https://en.wikipedia.org/wiki/The_Linux_Programming_Interfac...

https://man7.org/tlpi/

I am not sure if there is a good POSIX-based network programming book for the Windows platform. Most of my experience is with UNIX-based operating systems, so I am not as familiar. If the APIs are POSIX-compatible, it should not matter too much, just the tools you use will be different.


👤 Jugurtha
A kernel module that works like a "Schmitt trigger"[0].

Suppose that LO_THRESHOLD: 20% and HI_THRESHOLD: 80%. If your battery is lower than HI_THRESHOLD, it will allow your laptop to charge. Once it hits HI_THRESHOLD, it stops charging and your laptop gets energy from the battery, even if your power adapter is plugged in.

Once it hits LO_THRESHOLD, it starts charging again. See bang bang control[1], or a thermostat[2].

If we want to build a SaaS business around this and become billionaires:

Build a service accessible through sockets. I sign up for your service, you give me some sort of API keys. I install your software on my laptop, configure it with the keys.

If I have a screen, then running your software opens a link that does all the above automatically.

The local software monitors the temperature and sends them to your service through sockets. The application logic is in your server, and it sends the command either to CHARGING_ON, or CHARGING_OFF to the local program.

There are many people who like to charge their batteries between 30% and 80%.

Or, you can offer integrations with IFTTT[3] to trigger actions.

You can do it without the "SaaS" thingy and just offer it as it is.

[0]: https://en.wikipedia.org/wiki/Schmitt_trigger

[1]: https://en.wikipedia.org/wiki/Bang%E2%80%93bang_control

[2]: https://en.wikipedia.org/wiki/Thermostat

[3]: https://ifttt.com/


👤 pizza
Stream some media. Maybe audio into different network-attached speakers in your house, or setup a DIY home security system with a webcam on a raspberry pi streaming to a more powerful computer, or maybe make a youtube clone, or write an app that lets you control your computer with your phone, etc.

👤 non-entity
How much work are you looking to put in? I started working on a toy DHCP / TFTP / PXE server to gain a deeper understanding of PXE booting that I later put off. Maybe you could do something like that.

👤 satvikpendem
I've seen torrent clients written before, could be a useful exercise.

👤 cpach
Maybe write a small web server?

👤 Foober223
Napster