I want to read an obj ninja stream in c#. I've read, that it is an UDP stream.
I'm very inexperienct whith Networking and Socket programming, so please feel free to suggest completely different approaches.
My Idea so far: I have a function ReceiveSocket() which ist run in a new Thread:
Thread t = new Thread(ReceiveSocket);
t.Start();
void ReceiveSocket()
{
Uri myUri = new Uri(URL);
IPAddress ip = Dns.GetHostAddresses(myUri.Host)[0];
IPEndPoint RemoteIpEndPoint = new IPEndPoint(ip, 48001);
Socket socket = new Socket(RemoteIpEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Udp);
socket.Bind(RemoteIpEndPoint);
Debug.Log("Starting....");
while(true)
{
byte[] data = new byte[1024];
int received = socket.Receive(data);
Debug.Log("Received");
}
}
The URL is something like this: https://vdo.ninja/?view=2E7iCUg (just go on obs ninja and stream some Application, Monitor or Webcam)
But already in the Construction of the Socket (in ReceiveSocket()) is an Error thrown.
What I want to do: Read a Video Stream (in this example an obj ninja stream) and display each frame to a texture in Unity.
Thanks for your Help