Answers for "client socket and server socket in python"

1

socket python functions

#!/usr/bin/env python3

import socket

HOST = '127.0.0.1'  # The server's hostname or IP address
PORT = 65432        # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    s.sendall(b'Hello, world')
    data = s.recv(1024)

print('Received', repr(data))
Posted by: Guest on June-09-2021
0

socket python functions

conn, addr = s.accept()
Posted by: Guest on June-09-2021

Code answers related to "client socket and server socket in python"

Python Answers by Framework

Browse Popular Code Answers by Language