EmbLogic's Blog

Code that uses AF_UNIX address family to implement chatting between a single client and server.

RCS file: server.c,v
Working file: server.c
head: 1.12
branch:
locks: strict
root: 1.12
access list:
symbolic names:
keyword substitution: kv
total revisions: 12;    selected revisions: 12
description:
Code to demonstrate how a server accepts connections from a client on the same computer that is not networked.This code uses AF_UNIX address family for supporting chatting.
—————————-
revision 1.12    locked by: root;
date: 2014/02/04 23:26:15;  author: root;  state: Exp;  lines: +5 -3
prototypes of the writer and reader threads are changed.Client socket file descriptor is passed to both the threads function.
Both the reader writer threads in client and server are working properly.
Chatting program is successfully implemented.
—————————-
revision 1.11
date: 2014/02/04 16:14:36;  author: root;  state: Exp;  lines: +36 -15
The arguments inside the thread functions are changed but not inside the prototypes.
Fixing the error.
—————————-
revision 1.10
date: 2014/02/04 15:36:07;  author: root;  state: Exp;  lines: +2 -0
Prototypes of the two functions used by thread after they are created is declared.
Defining the body now………
—————————-
revision 1.9
date: 2014/02/04 15:31:51;  author: root;  state: Exp;  lines: +14 -0
Two threads:writer and reader are created using pthread_create().If unsuccessful an error message is displayed.
Header file:<pthread.h> is included to support thread related functions.
Declaring prototypes and defining the body of the functions…..
—————————-
revision 1.8
date: 2014/02/04 15:01:39;  author: root;  state: Exp;  lines: +1 -0
unlink() system call is used to remove the socket if present previously.
—————————-
revision 1.7
date: 2014/02/04 14:59:44;  author: root;  state: Exp;  lines: +1 -1
A small bug fixed.
Issue:Misspelled client_sockfd.
—————————-
revision 1.6
date: 2014/02/04 14:57:08;  author: root;  state: Exp;  lines: +8 -0
accept() system call is used to make the server wait for incoming connection requests from clients.
Checking…….
—————————-
revision 1.5
date: 2014/02/04 14:52:12;  author: root;  state: Exp;  lines: +6 -0
Socket queue creation is done using listen() system call.
An error message is displayed on error.
—————————-
revision 1.4
date: 2014/02/04 14:48:30;  author: root;  state: Exp;  lines: +11 -1
Naming of a socket is done using bind() system call.After the successfull execution
of the system call the server will create a socket named “socket”.An error message is displayed on error.
Checking………………..
—————————-
revision 1.3
date: 2014/02/04 14:37:12;  author: root;  state: Exp;  lines: +3 -0
Header file:<sys/socket.h> and <sys/types.h> are included to support socket related functions.
Now comiling the program to check……
—————————-
revision 1.2
date: 2014/02/04 14:33:38;  author: root;  state: Exp;  lines: +1 -0
Header file:<stdlib.h> is included to support exit() function.
Socket is created using socket() system call and an error message is displayed on error.
—————————-
revision 1.1
date: 2014/02/04 14:32:48;  author: root;  state: Exp;
Initial revision
=============================================================================
RCS file: client.c,v
Working file: client.c
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
Code to demonstrate how client sends a request to get connect to a client.
After connection is established chatting is done between client and server.
—————————-
revision 1.3
date: 2014/02/04 23:32:14;  author: root;  state: Exp;  lines: +10 -6
Client successfully connects to the server and chatting between both is taking place correctly.
—————————-
revision 1.2
date: 2014/02/04 16:04:39;  author: root;  state: Exp;  lines: +36 -1
two threads are created namely reader and writer threads.
The functions for reader and writer threads are implemented.
Checking……
—————————-
revision 1.1
date: 2014/02/04 15:13:35;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>