socket_read_ascii_float receives ? in polyscope . trying to send float values from python via socket connection but polyscope reads it as ? and when try to send integer using socket_binary_integer command it reads -1 which .
Maybe post the python as well so we have the other half of the puzzle
Echo client program
import socket
import time
HOST = “10.220.30.38” # The remote host
PORT = 30002 # The same port as used by the server
#print “Starting Program”
count = 0
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((“”, PORT)) # Bind to the port
s.listen(5) # Now wait for client connection.
print(“listening”)
c, addr = s.accept() # Establish connection with client.
while (count < 1000):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((“”, PORT)) # Bind to the port
s.listen(5) # Now wait for client connection.
c, addr = s.accept() # Establish connection with client.
try:
msg = c.recv(1024)
# print msg
time.sleep(1)
if msg == “asking_for_data”:
count = count + 1
# print “The count is:”, count
time.sleep(0.5)
# print “”
c.send("(2.0)");
# c.send("(200.0,50.0,45.0)");
print ("Send 200, 50, 45")
except socket.error as socketerror:
#print count
c.close()
s.close()
#print “Program finish”
reposting the code for anyone who wants to read it a little easier (three backticks on each side)
import socket
import time
HOST = "10.220.30.38" # The remote host
PORT = 30002 # The same port as used by the server
count = 0
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("", PORT)) # Bind to the port
s.listen(5) # Now wait for client connection.
print("listening")
c, addr = s.accept() # Establish connection with client.
while (count < 1000):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("", PORT)) # Bind to the port
s.listen(5) # Now wait for client connection.
c, addr = s.accept() # Establish connection with client.
try:
msg = c.recv(1024)
time.sleep(1)
if msg == "asking_for_data":
count = count + 1
time.sleep(0.5)
c.send("(2.0)")
# c.send("(200.0,50.0,45.0)");
print("Send 200, 50, 45")
except socket.error as socketerror:
c.close()
s.close()