This fixes some bugs.

This commit is contained in:
Emiliana 2020-02-27 00:38:46 +01:00
parent cd9cfd9ee8
commit 4a88c57be2
2 changed files with 15 additions and 7 deletions

View file

@ -179,20 +179,26 @@ public class OpenSee : MonoBehaviour {
}
void Start () {
openSeeDataMap = new Dictionary<int, OpenSeeData>();
if (openSeeDataMap == null)
openSeeDataMap = new Dictionary<int, OpenSeeData>();
buffer = new byte[65535];
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPAddress ip;
IPAddress.TryParse(listenAddress, out ip);
socket.Bind(new IPEndPoint(ip, listenPort));
socket.ReceiveTimeout = 15;
if (socket == null) {
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPAddress ip;
IPAddress.TryParse(listenAddress, out ip);
socket.Bind(new IPEndPoint(ip, listenPort));
socket.ReceiveTimeout = 15;
}
receiveThread = new Thread(() => performReception());
receiveThread.Start();
}
void Update () {
if (!receiveThread.IsAlive) {
Start();
}
}
void EndReceiver() {