I run the following in Blender to recievereceive coordinates over sockets, but the system hangs (the server is created, meaning the script runs, but then blender application tends to stop showing any output).
import socket,json,bpy
host = "127.0.0.1"
port = 1234
buffer_size = 1024
my_socket = socket.socket()
my_socket.bind( (host, port) )
my_socket.listen(1); # listen indefinately
conn, addr = my_socket.accept()
print("Connected to client at :"+str(addr))
while True:
data = conn.recv(buffer_size).decode()
if not data:
break
data = json.loads(data)
conn.send("ACK".encode()) # for synchronization
bpy.data.objects['Sphere.005'].location = (data['x1_coord'],data['y1_coord'],0)
conn.close()