A tiny minimalistic CHAT Client Program writen in
C
A friend of mine (Dido) who is learning C programming, has written
a
tiny chat server / client (peer to peer) program in C. His
program is a very good learning curve for anyone desiring to
learn basic C socket programming.
The program is writen in a way so it can be easily modified to work
over UDP protocol with code:
struct sockaddr_in a;
a_sin_family=AF_INET;
a_sin_socktype=SOCK_DGRAM;
Here are links to the code of the Chat server/client progs:
Tiny C
Chat Server Client source code
Tiny C
Chat Client source code
To Use the client/server compile on the server host
tiny-chat-serer-client.c with:
$ cc -o tiny-chat-server
tiny-chat-server.c
Then on the client host compile the client;
$ cc -o tiny-chat-client
tiny-chat-client.c
On the server host
tiny-chat-server should be ran with port
as argument, e.g. ;
$ ./tiny-chat-server 8888
To chat with the person running
tiny-chat-server the
compiled server should be invoked with:
$ ./tiny-chat-client 123.123.123.123 8888
123.123.123.123 is the IP address of the host, where
tiny-chat-server is executed. The programs are in a very
basic stage, there are no condition checks for incorrectly passed
arguments and with wrongly passed arguments it segfaults. Still for
C beginners its useful ...