Answers for "client server python socket"

0

client server python socket

#!/usr/bin/python           # This is server.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.
s.bind((host, port))        # Bind to the port

s.listen(5)                 # Now wait for client connection.
while True:
   c, addr = s.accept()     # Establish connection with client.
   print 'Got connection from', addr
   c.send('Thank you for connecting')
   c.close()                # Close the connection
Posted by: Guest on December-15-2020
-2

client server python socket

s = socket.socket (socket_family, socket_type, protocol=0)
Posted by: Guest on December-15-2020

Code answers related to "client server python socket"

Python Answers by Framework

Browse Popular Code Answers by Language