### Python TCP/IP receiver for iFacialMocap Source: https://www.ifacialmocap.com/for-developer Python example for receiving iFacialMocap data over TCP/IP. It first sends a UDP handshake message to port 49983 on the iOS device, then creates a TCP server on port 49986 to receive frames. The received data is decoded as UTF-8 and printed. ```python from socket import socket, AF_INET, SOCK_DGRAM, SOCK_STREAM #UDP send HOST = '' PORT = 49983 ADDRESS = "192.168.1.7" #iOS address s = socket(AF_INET, SOCK_DGRAM) msg = "iFacialMocap_UDPTCP_sahuasouryya9218sauhuiayeta91555dy3719" s.sendto(msg.encode(), (ADDRESS, PORT)) s.close() #create tcp server with socket(AF_INET, SOCK_STREAM) as tcp_server: tcp_server.bind(("192.168.1.5", 49986)) #192.168.1.5 is pc address tcp_server.listen(1) while True: conn, addr = tcp_server.accept() with conn: while True: data = conn.recv(10000) print(data.decode('utf-8')) ``` -------------------------------- ### Receive iFacialMocap data via UDP in Python Source: https://www.ifacialmocap.com/for-developer Sends the trigger string to the iOS device on port 49983 and then listens on UDP port 49983 to receive facial data at 60 FPS. Requires the PC to be on the same network as the iOS device; replace DstIP with the device's IP address. ```python from socket import * DstIP = "192.168.1.7" DstPort = 49983 DstAddr = (DstIP,DstPort) udpClntSock = socket(AF_INET, SOCK_DGRAM) data = "iFacialMocap_sahuasouryya9218sauhuiayeta91555dy3719" data = data.encode('utf-8') udpClntSock.sendto(data,DstAddr) server = socket(AF_INET, SOCK_DGRAM) server.bind(("", 49983)) server.settimeout(0.05) while True: try: messages, address = server.recvfrom(8192) print(messages.decode('utf-8')) except: pass ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.