Question: In C++ or C please Write a simple TCP program for a server that accepts lines of input from a client and prints the lines

In C++ or C please

Write a simple TCP program for a server that accepts lines of input from a client and prints the lines onto the servers standard output. (You can do this by modifying the TCPServer.py program in the text.) Compile and execute your program. On any other machine that contains a Web browser, set the proxy server in the browser to the host that is running your server program; also con- figure the port number appropriately. Your browser should now send its GET request messages to your server, and your server should display the messages on its standard output. Use this platform to determine whether your browser generates conditional GET messages for objects that are locally cached.

here is the TCPServer.py

Here is the code for the client side of the application:

from socket import * serverName = servername serverPort = 12000 clientSocket = socket(AF_INET, SOCK_STREAM)

clientSocket.connect((serverName,serverPort))

sentence = raw_input(Input lowercase sentence:)

clientSocket.send(sentence)

modifiedSentence = clientSocket.recv(1024)

print From Server:, modifiedSentence

clientSocket.close()

.................

the server program.

from socket import * serverPort = 12000 serverSocket = socket(AF_INET,SOCK_STREAM)

serverSocket.bind((,serverPort))

serverSocket.listen(1) print The server is ready to receive

while 1:

connectionSocket, addr = serverSocket.accept()

sentence = connectionSocket.recv(1024)

capitalizedSentence = sentence.upper()

connectionSocket.send(capitalizedSentence)

connectionSocket.close()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!