0
Socket
How can you send a message in a server using socket? I want to create a server that can send msgs to client and they can send msgs back. Plssssss help!
3 odpowiedzi
+ 1
i dunno, i'm not a good python programmer, but i think that's possible using scapy
https://scapy.net
0
Alright ill check it out! Thx
0
ummm... what a delay :)
use this tamplet (only works for one client at a time):
import socket
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(('0.0.0.0', 8820))
server_socket.listen()
client_conn, addr = server_socket.accept()
while True:
data = client_conn.recv(1024).decode()
print(f"Client Said {data}")
if data == 'Quit':
client_conn.send('OK, Bye'.encode())
break
else:
client_conn.send(data.encode())
client_conn.close()
server_socket.close()