Solved Networking Problems
Develop a TCP-based server and client using C. The single client requests data from a file on the server. The server opens the file and sends data back to the client. Given: The server has few text files files in its present working directory. The client and server will work in separate directories.
Input: The server will accept its port number as the input parameter. The client sends a query to server requesting data from to the server. The client will accept sever's IP address, server' port number, and the requested as input parameters.
Output: The server parses the query and returns the first 10 bytes of the file . On receiving the data, the client creates the file and stores the data.
Error handling: If the server is unreachable, the client must say so. If the requested file is missing, the server sends an empty file to the client.
A TCP server and a client for the following.
- The server as a command line argument accepts the port number to which it should bind.
- The client, as command line arguments, accepts the IP address and the port number at which it will find the server.
- After connecting to the server, the client reads a line from the standard input and sends it to the server.
- The server prints the received line in the reverser order and reads a line from the standard input and sends it to the client or all the clients.
- The client prints the received line in the reverse order and is ready to accept a new line from the user.
- The client exits if the user type "exit".
- The server at a time accepts at the most four clients. Any client above the limit is rejected. (4 marks) As and when the number is less than the limit, the server accepts the new client.
A TCP client to download and locally save a file.
- The client, as a command-line argument, accepts the URL of the file. The URL can be HTTP or HTTPS-based.
- If the URL does not exist or unreachable, the client prints an error and exits.
- After connecting to the server, the client sends a GET request to the server.
- The client downloads the whole file and saves it to the local folder with the same file name as mentioned in the URL.
- If a file with the same name exists, the old file is overwritten.
- The client exits after downloading the file.
A program that uses public key-private key encryption to encrypt and decrypt a text file. The maximum size of the file is 1Kbytes.
-
The encryption program accepts public key, name of the file, and name of the output file as command line input parameters. It encrypts the file and stores it as the given name of the output file.
-
The decryption program accepts private key, name of the encrypted file, and name of the decrypted file as command line input parameters. It decrypts the file and stores it as the given name of the output file.
There are two clients and a server in the application. The two clients communicate privately with each other via the server. When any client sends an encrypted message, the message and its decryption are displayed in the other client.
- The server as a command line argument accepts the port number to which it should bind.
- Each client, as command line arguments, accepts the IP address at which it will find the server, the port number of the server at that IP address, the filename containing its private key, and the filename containing the other client's public key.
- After connecting to the server, the client keeps on reading a line from the standard input. It encrypts the line and sends it to the server.
- The server forwards the message received from one client to another.
- When a client receives a message from the other client, it decrypts and displays both ciphertext and plaintext.
- Both the clients exit if the user types "exit" in any client.