|
| 1 | +# Socket-Programming-in-C |
| 2 | + |
| 3 | +In |
| 4 | +Assignment1/ |
| 5 | + |
| 6 | +These questions are a part of assignment of Computer Networks course. |
| 7 | +QUESTION_1 |
| 8 | +Write a client-server program that provides text and voice chat facility using datagram socket. |
| 9 | +Your application allows a user on one machine to talk to a user on another machine. Your |
| 10 | +application should provide non blocking chat facility to the users. This means, the user can send |
| 11 | +its message at any time without waiting for a reply from the other side. |
| 12 | +(Hint: Use select() system call). |
| 13 | +NOTE-I DID NOT PROVIDE VOICE CHAT FACILITY |
| 14 | + |
| 15 | +QUESTION_2 |
| 16 | +Write a TCP client-server system to allow client programs to get the system date and time from |
| 17 | +the server. When a client connects to the server, the server gets the local time on the machine and |
| 18 | +sends it to the client. The client displays the date and time on the screen, and terminates. The |
| 19 | +server should be an iterative server. |
| 20 | + |
| 21 | +QUESTION_3 |
| 22 | +Write a simple UDP iterative server and client to convert a given DNS name (for example, |
| 23 | +www.google.com) into its IP address(es). The client will read the DNS name as a string from the |
| 24 | +user and send it to the server. The server will convert it to one or more IP addresses and return it |
| 25 | +back to the client. The client will then print ALL the addresses returned, and exit. For basic UDP |
| 26 | +socket communication, see the sample program given. To get the IP address corresponding to a |
| 27 | +DNS name, use the function gethostbyname(). Look up the description of the function from the |
| 28 | +man page and the tutorial on the webpage. |
| 29 | + |
| 30 | +QUESTION_4 |
| 31 | +Now suppose that the same server will act both as the time server in Problem 1 and the DNS |
| 32 | +server in Problem 2. Thus, some clients will request over the UDP socket for name-to-IP |
| 33 | +conversion, and some will connect over a TCP socket for the time. Thus, the server now needs to |
| 34 | +open both a TCP socket and a UDP socket, and accept request from any one (using the accept() + |
| 35 | +read()/send() call for TCP, and recvfrom() call for UDP), whichever comes first. Use the select() |
| 36 | +call to make the server wait for any one of the two connections, and handle whichever comes |
| 37 | +first. All handlings are iterative. |
| 38 | + |
| 39 | + |
| 40 | +Detailed explanation in Explanation.pdf. |
0 commit comments