erunways 0 Newbie Poster

Sockets are one of the most popular means of network communication and they follow client-server architecture. I have created two programs, one to run on a client computer and

the other on the server computer. In my program I am showing how using a sockets client program can communicate to a server. The client program is run at the client-side while

the server program runs in the Internet. I am using a socket module which is provided by Python. When the client runs the echo-client.py program it is prompted to enter the

address to the server which could either be a domain name which I used for the testing or an IP address. Keep in mind that the server side program echo-server.py has to be running

in order for the connection to be established. Once the user enters the address to the server it’s prompted to enter a message for the server. Once he enters the message and presses

enter the message is send to the server. The server side program gets the message and displays it and also returns it back to the client. The final step for the server is to close itself

once that one cycle is complete. The client on the other side displays a message that the message has been received by the user and even shows it just to so the user is sure of it and

finally closes itself.

CLIENT SCRIPT

SERVER SCRIPT

DEMO RESULTS

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.