Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python port forwarding

#Server Side 
import socket
sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 5555
sock.bind((host, port))
sock.listen(1)
conn, addr = sock.accept()
data = "Hello!"
data = bytes(data, 'utf-8')
conn.send(data)
sock.close()

#Client 
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 5555
sock.connect((host, port))
data = sock.recv(2048)
data = str(data, "utf-8")
sock.close()
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter triangle 
Python :: how to convert uppercase to lowercase and vice versa in python 
Python :: py string find regex pos 
Python :: Python NumPy asfarray Function Example List to float type array 
Python :: numpy vs tensorflow 
Python :: how to clear combobox tkinter 
Python :: nested python list 
Python :: csv to pdf python 
Python :: python how do index all odd numbers in a list 
Python :: dataframe partition dataset based on column 
Python :: Can there be an if statement inside an if statement python 
Python :: functional conflict definition 
Python :: bst in python 
Python :: Python Switch case statement Using classes 
Python :: Reverse an string Using Reversed 
Python :: Mixed Fractions in python 
Python :: forward checking algorithm python 
Python :: py to flag converter online 
Python :: python api with live ercot real time prices 
Python :: python - retrieve unconnected node pairs 
Python :: ftplib tqdm 
Python :: feed-forward network medium 
Shell :: Could not find the implementation for builder @angular-devkit/build-angular:dev-server 
Shell :: uninstall k3s 
Shell :: git stas hauntracked files 
Shell :: git save password global 
Shell :: ubuntu settings not opening 20.04 
Shell :: linux check ram frequency 
Shell :: install wps ubuntu 
Shell :: curl file share 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =