|
@@ -30,6 +30,15 @@ while True:
|
|
|
print("SERVER_TCP_PORT=", rport, sep="")
|
|
|
sock.sendto(str(rport).encode(), clientAddress) # send new socket port to client
|
|
|
newConn = False
|
|
|
+
|
|
|
+ # get confirmation of port, send OK
|
|
|
+ confirm, newaddr = sock.recvfrom(1024)
|
|
|
+ if (confirm.decode() == str(rport)):
|
|
|
+ sock.sendto("correct".encode(), newaddr)
|
|
|
+ else:
|
|
|
+ print("Received wrong port number, fail")
|
|
|
+ exit(1)
|
|
|
+
|
|
|
tsock.listen(1)
|
|
|
|
|
|
# now put logic for TCP socket behaviour
|