Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python network programming

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
Comment

PREVIOUS NEXT
Code Example
Python :: python parentheses 
Python :: how to aggregate multiple columns in pyspark 
Python :: feature importance naive bayes python 
Python :: remove ,drop,effacer, dataframe,python 
Python :: select rows from dataframe pandas 
Python :: python remove suffix 
Python :: pytthon remove duplicates from list 
Python :: how to define the name of your tkinter window 
Python :: get all subsets of a list python 
Python :: 3 dimensional array numpy 
Python :: requests.Session() proxies 
Python :: number system conversion python 
Python :: pyqt disable maximize button 
Python :: python byte string 
Python :: python convert images to pdf 
Python :: calculate mean on python 
Python :: importing database in dataframe using sqlalchemy 
Python :: making a virtual environment python 
Python :: python iterate list 
Python :: give a function a name python 
Python :: python function get number of arguments 
Python :: split a text file into multiple paragraphs python 
Python :: python loop go back to start 
Python :: if list item in string python 
Python :: how to make a button in python turtle 
Python :: contextlib.subppress python 
Python :: string to array python 
Python :: matplotlib vertical line 
Python :: progress bar python 
Python :: strp datetime 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =