$24.99
The only logical change you need to make is to implement your exchange of messages as a protocol. The protocol will be structured as follows (note, a string of digits followed by a b means a binary number):
Requests:
byte content
---- -------
0 request code, 0000001b = name, 00001001b = number
1-n request data
n+1 end-of-request, 00000011b (ETX)
Replies:
byte content ---- -------
0-n reply data
n+1 end-of-reply, 00000011b (ETX)
Note that the requests allow for both name and number matching, so you need to also be able to match a name. Nothing fancy, an exact match is required. Also note that the character string can contain any type of byte oriented data, including binary representations of numbers. For example:
short val; char * message; message = &val;
send (sock, message, 2, 0);
2. Write a client-server program that provides text and voice chat facility using datagram socket. Your application allows a user on one machine to talk to a user on another machine. Your application should provide non blocking chat facility to the users. This means, user can send its message at any time without waiting for replay from the other side. (Hint: Use select() system call).