Possible Duplicate:
simple client and server
I want to learn how to code a server in C, preferentially using threads, but i don't know where to start. I just want to learn the real basics to improve it gradually, so i think i want to code something simple first, like an echo server. can anyone help me?
If you are interested in Network Programming then Beej's Guide to Network Programming might be of interest.
I suggest getting the Stevens TCP/IP Illustrated series. There is example code which walks you through that sort of thing. Yes, it goes into a great deal of detail not 100% necessary to just write a simple TCP server, but it very good none-the-less.
You might also want to take a peek at the ttcp.c source code. It hooks standard in to the network to standard out. eg:
host b> ttcp -r | tar xf -
host a> tar cf - . | ttcp -t b
Though simply running:
host b> ttcp -r
host a> ttcp -t b
Should show you the concepts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With