Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where should i start to learn how to write a server in C? [duplicate]

Tags:

c

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?

like image 591
Hugo Mota Avatar asked Jan 20 '23 09:01

Hugo Mota


2 Answers

If you are interested in Network Programming then Beej's Guide to Network Programming might be of interest.

like image 167
Bart Avatar answered Mar 28 '23 22:03

Bart


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.

like image 29
Seth Robertson Avatar answered Mar 28 '23 20:03

Seth Robertson