Change to udp with the sockets
This commit is contained in:
parent
365162de06
commit
815061e2f0
@ -17,7 +17,7 @@ BUFFER_SIZE = 128
|
|||||||
SEPARATOR = "<SEPARATOR>"
|
SEPARATOR = "<SEPARATOR>"
|
||||||
# create the server socket
|
# create the server socket
|
||||||
# TCP socket
|
# TCP socket
|
||||||
s = socket.socket()
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
# bind the socket to our local address
|
# bind the socket to our local address
|
||||||
s.bind((SERVER_HOST, SERVER_PORT))
|
s.bind((SERVER_HOST, SERVER_PORT))
|
||||||
# enabling our server to accept connections
|
# enabling our server to accept connections
|
||||||
|
@ -24,7 +24,7 @@ filename = "screen.jpg"
|
|||||||
filesize = os.path.getsize(filename)
|
filesize = os.path.getsize(filename)
|
||||||
|
|
||||||
# create the client socket
|
# create the client socket
|
||||||
s = socket.socket()
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
print(f"[+] Connecting to {host}:{port}")
|
print(f"[+] Connecting to {host}:{port}")
|
||||||
s.connect((host, port))
|
s.connect((host, port))
|
||||||
print("[+] Connected.")
|
print("[+] Connected.")
|
||||||
|
@ -30,7 +30,7 @@ host = "123.123.123.123"
|
|||||||
port = 5001
|
port = 5001
|
||||||
|
|
||||||
# create the client socket
|
# create the client socket
|
||||||
s = socket.socket()
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
print(f"[+] Connecting to {host}:{port}")
|
print(f"[+] Connecting to {host}:{port}")
|
||||||
s.connect((host, port))
|
s.connect((host, port))
|
||||||
print("[+] Connected.")
|
print("[+] Connected.")
|
||||||
|
@ -10,7 +10,7 @@ BUFFER_SIZE = 4096
|
|||||||
SEPARATOR = "<SEPARATOR>"
|
SEPARATOR = "<SEPARATOR>"
|
||||||
# create the server socket
|
# create the server socket
|
||||||
# TCP socket
|
# TCP socket
|
||||||
s = socket.socket()
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
# bind the socket to our local address
|
# bind the socket to our local address
|
||||||
s.bind((SERVER_HOST, SERVER_PORT))
|
s.bind((SERVER_HOST, SERVER_PORT))
|
||||||
# enabling our server to accept connections
|
# enabling our server to accept connections
|
||||||
|
Loading…
x
Reference in New Issue
Block a user