Skip to main content
edited body
Source Link
Chris
  • 1
  • 6
  • 35
  • 98

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()

I run the following in Blender to recieve 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()

I run the following in Blender to receive 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()
fixed formatting, title, tags
Link
Ray Mairlot
  • 29.4k
  • 12
  • 105
  • 126

Blender tends to crushcrash while using sockets?

#iI run thisthe following in blenderBlender to recieve coordinates over sockets.But, but the system hangs  (the server is created  ,meaning 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()

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()

#i run this in blender to recieve 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()

I run the following in Blender to recieve 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()
Source Link
Loading