Reputation: 103
I have a basic python socket, like:
server.py
import socket
ip = '192.168.2.231'
port = 2005
addr = (ip, port)
serv_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv_socket.bind(addr)
serv_socket.listen(2)
con, cliente = serv_socket.accept()
receive = con.recv(1024)
if receive == '0123456789':
#print "Accepted ACK"
HERE - how can i send a message to client.py back
serv_socket.close()
How can i respond to the client.py that the sent ACK is correct? On line 16(server.py) I perform an IF and print a message, I want send a message back to the client.py saying that the ACK is invalid / invalid
Upvotes: 0
Views: 4756
Reputation: 407
You'll just use the client socket to send a response.
con, cliente = serv_socket.accept()
receive = con.recv(1024)
if receive == '0123456789':
con.send("ACK")
serv_socket.close()
Upvotes: 1