Socket Programming: Lab Exercise
Socket Programming: Lab Exercise
Lab Exercise
• Host
• Sender and receiver
• Client and server
• Socket – port+IP
Client, Server and Socket
• A server is a software that waits for client requests
and serves or processes them accordingly.
• a client is requester of this service. A client program
request for some resources to the server
• Socket is the endpoint of a bidirectional
communications channel between server and client.
• Sockets may communicate within a process,
between processes on the same machine, or
between processes on different machines.
Python Socket Example
• Two programs – client.py server.py
• Two machines or one machine – two command prompt
• Complete server.py
• Go to command prompt
• Execute server.py
• Python socket server program executes at first and wait for any request
• Write client. py
• Go to new command prompt
• Execute client.py
• TCP socket program
• Port address and IP, TCP socket – connection estalblishment data transfer connection close
An ARP cache is a collection of Address Resolution Protocol entries (mostly dynamic) that
are created when an IP address is resolved to a MAC address (so the computer can
effectively communicate with the IP address).
• “192.168.10.10”, “FF.CC.DD.11”
• “192.168.10.1”, “CC.FF.11.22”
• “192,168.0.1”, “DD.11.2.2”
• 192.168.1.120”,”AA.1.1.1”
• Str[4][2]
• If(data==str[0][0])
• Data=str[0][1]
• Data.encode()