Unity does not accept using UDP.
Pure .Net Framework 4.7 confirmed that they receive normally with the same code, but Unity cannot receive them by any means.
The following code is for receiving used by Unity: private void VideoStreamReceive() { UdpClient VideoStream = new UdpClient();
Debug.Log("VideoStream Receving");
VideoStream.Client.Bind(new IPEndPoint(IPAddress.Any, 11111));
//VideoStream.EnableBroadcast = true;
IPEndPoint ep = new IPEndPoint(IPAddress.Any, 0);
while (VideoStream != null)
{
try
{
byte[] bytes = VideoStream.Receive(ref ep);
Debug.Log(ep.ToString() + " VS > " + Encoding.UTF8.GetString(bytes, 0, bytes.Length));
}
catch(ThreadAbortException abort)
{
Debug.LogWarning(abort);
}
catch (System.Exception e)
{
Debug.LogError("VS오류 : " + e);
}
}
}
The following code is for listening in the .Net Framework 4.7:
UdpClient video = new UdpClient();
video.Client.Bind(new IPEndPoint(IPAddress.Any, 11111));
IPEndPoint videoPoint = new IPEndPoint(IPAddress.Any, 0);
// video.Client.ReceiveTimeout = 20;
for(tryCount = 0; tryCount < 100; tryCount++)
{
byte[] receive = video.Receive(ref videoPoint);
if(receive == null)
{
Console.WriteLine(tryCount + " : Fail");
}else if(receive.Length == 0)
{
Console.WriteLine(tryCount + " : Zero");
}
else
{
Console.WriteLine(tryCount + " : " + receive.Length);
}
}
video.Close();
I used IronPython for Unity to listen in a 2.7.10 version environment, but I didn't receive it when I was driving in Unity, and I received it in a pure Python. Is there any way to solve this?
Comment
Your answer
Follow this Question
Related Questions
Unity Socket Port-forward 0 Answers
Improving script which Spawns enemies up to a required number 0 Answers
HOW TO ADD GRAVITY TO A OBJECT? 2 Answers
NPC walking on air when targeting player 1 Answer
Instantiation help 0 Answers