I want to read a TCP stream into blender to use it for facial capture

There is an amazing App for Android:

and it is sending its data via a TCP stream.
The data is send in the following structure:

I would really like to know, how I can get this data into Blender.
I’m just a scriptkid, like copy, paste and modify.
But once I understand how to get the data into blender, I should be able to
write my own script to get the data onto my models.

Thanks in advance

Yours Spero…

This is something I found so far

import socket

# open network socket
port = 9996
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("192.168.1.6", port))
print ("waiting on port:", port)

# poll data (could use a timer)
data, addr = s.recvfrom(1024) 
print (data)

But I get the following Error if I try it

Traceback (most recent call last):
File “\Text”, line 6, in
OSError: [WinError 10049] Die angeforderte Adresse ist in diesem Kontext ung├╝ltig
Error: Python script failed, check the message in the system console

“Die angeforderte Adresse ist in diesem Kontext ung├╝ltig”
means the called adress is not valid in this context

Thanks in advance again.
Spero…

Ok, with the following code I seem to get some data :sweat_smile:

import socket
port=9996
host='192.168.1.6'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
print ("waiting on port:", port)
data = s.recvfrom(1024) 
print(data)
s.close()

So I’ll try to make sense of it,
still any help very much appreciated.

Thanks Spero…

Changed the code again a little: :upside_down_face:

import socket
port=9996
host='192.168.1.6'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
print ("waiting on port:", port)
for x in range(6):
    data = s.recvfrom(22000)
    print(data)
s.close()

Now I get enough data in the console, to get the 468 floating coordinates for one face between to “?”.
But it starts just somewhere in the datastream and ends somewhere in the middle.
I did the for loop, so I could get more data in the console.
This way I could see that there actually is always 468 coords between 2 “?”.
But now I need help to get the code to receive the data with the 1st “?” and stop receiving with the next “?”.
To be able to catch each frame :sweat_smile:

Thanks again
Spero…

Did you get it to work?