What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-18 07:25:23
python multiplayer
#some server thingy i found online. server = "" port = 5555 games = {} idCount = 0 currentPlayer = 0 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((server, port)) s.listen() print("Waiting for a connection, Server Star... Add solution -
Python 2022-01-24 04:47:09
send get request python socket
import socket target_host = "www.google.com" target_port = 80 # create a socket object client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connect the client client.connect((target_host,target_port)) # send... Add solution -
Python 2021-11-17 11:49:13
python network programming
#!/usr/bin/env python3 import socket HOST = '127.0.0.1' # Standard loopback interface address (localhost) PORT = 65432 # Port to listen on (non-privileged ports are > 1023) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.b... Add solution -
Python 2021-11-15 20:20:18
python tcp socket example
import socket TCP_IP = '127.0.0.1' TCP_PORT = 5005 BUFFER_SIZE = 1024 MESSAGE = "Hello, World!" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) s.send(MESSAGE) data = s.recv(BUFFER_SIZE) s.close() print "... Add solution -
Python 2021-11-11 07:26:15
send message from server to client python
import socket import sys HOST = '' PORT = 9000 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print 'Socket created' try: s.bind((HOST, PORT)) except socket.error , msg: print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1... Add solution -
Python 2021-11-05 02:25:06
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... Add solution
Best helpers
Ranking is empty