Skip to content

Commit

Permalink
fix udp_client.py too to print chars correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Feb 5, 2024
1 parent 02e51d8 commit 63ba710
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Tools/scripts/udp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import socket
import threading
import os
import sys

try:
Expand All @@ -20,14 +19,23 @@

def send():
while True:
m = input()
m = m + "\r\n"
s.sendto(m.encode('utf-8') , (ip,int(port)))
try:
m = input()
m = m + "\r\n"
s.sendto(m.encode('utf-8') , (ip,int(port)))
except:
print("Error sending to " + ip + ":" + port)
sys.exit()

def rec():
while True:
msg = s.recvfrom(1024)
print(msg[0].decode())
try :
msg = s.recvfrom(1024)
sys.stdout.write(msg[0].decode('utf-8'))
# sys.stdout.write("\r\n")
except:
print("Error reading from " + ip + ":" + port)
sys.exit()

x1 = threading.Thread( target = send )
x2 = threading.Thread( target = rec )
Expand Down

0 comments on commit 63ba710

Please sign in to comment.