Professional Documents
Culture Documents
Module 2 - Socket Programming With Python
Module 2 - Socket Programming With Python
uModule 2
Programming
with Python
What is socket?
Socket programming
goal: learn how to build client/server applications that communicate using sockets
socket: dropbox between application process and end-end-transport protocol
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
Application Layer
Socket Vocabulary
The Socket Module
• To create a socket, you must use the socket.socket() function available in socket
module, which has the general syntax:
Once you have socket object, then you can use required functions
to create your client or server program. Following is the list of
functions required:
Client Socket Methods
General Socket Methods
A Simple TCP
Server
A Simple TCP Client
Running Your TCP Client Server
Program
• Run server.py at the background, then run client.py
• The output would be like this:
Summary