tcpviewer_client.py 522 B

12345678910111213141516171819202122
  1. # Echo client program
  2. import socket
  3. import igl
  4. import array
  5. HOST = '' # The remote host
  6. PORT = 50008 # The same port as used by the server
  7. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  8. s.connect((HOST, PORT))
  9. V = igl.eigen.MatrixXd()
  10. F = igl.eigen.MatrixXi()
  11. igl.readOFF('../tutorial/shared/beetle.off', V, F)
  12. viewer = igl.viewer.Viewer()
  13. viewer.data.set_mesh(V,F)
  14. data = viewer.serialize()
  15. print(type(data[0]).__name__)
  16. viewer.deserialize(data)
  17. a = array.array('u',data)
  18. s.sendall(a)
  19. s.close()