So I have a simple Python script to receive data from a client with socket. The script works fine outside of Blender and functions in Blender as well (I can see incoming data from the client when I run Blender from the terminal). However Blender’s GUI freezes on script execution and no further input is possible in the GUI.
The script is as follows:
#!/usr/bin/env python3 #SERVER import bge import socket def Main(): host = '127.0.0.1' port = 5000 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((host,port)) print ( "Server Started.") while True: data, addr = s.recvfrom(1024) print ( "message From: " + str(addr)) print ( "from connected user: " + data.decode()) c.close() if __name__ == '__main__': Main()
I’m brand new to Python and Blender so any help would be greatly appreciated.