Author: arnuldarnuld
Date: Jul 14, 2008 21:46
WANTED: This program is a TCP echo server-client. server is written using
poll() while client is written using threads.
1.) server recv()s some characters from a client and then echoes the
characters to all clients except the one who sent it.
2.) client has 2 threads, one thread send()s something to the server
once, 2nd thread waits infinitely for recv(), as I want the thread to
remain connected to recv() the input.
PROBLEM: one client disconnects as soon as another connects. after that
no client remains connected. After 2 or 3 attempts server
disconnects too.
I am at the bginning stage of learning TCP/IP things, as you already know
and most of the things I have written do not make much sense to me. e.g. I
do know what socket(), bind(), listen(), connect(), send() and recv() work
but I do not have much idea about how poll() works and when server poll()
starts etc. I just did it as told in UNP volume 1.
--------------------------- poll-server.c ------------------------------------
/* A server handeling multiple clients using poll()
VERSION: 1.1
*/
|