private void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; DontDestroyOnLoad(gameObject); } }
public TCPHandler(string ip, ushort sendPort, ushort receivePort, int timeout, SocketIo parentSocket) : base(ip, sendPort, receivePort, timeout, parentSocket) { }
public WebSocketHandler(string ip, ushort sendPort, ushort receivePort, int timeout, SocketIo parentSocket) : base(ip, sendPort, receivePort, timeout, parentSocket) { if (SendPort == 0) { SendPort = ReceivePort; } if (ReceivePort == 0) { ReceivePort = SendPort; } if (SendPort != ReceivePort) { throw new Exception("WebSockets must Send and Receive on the same port."); } _socket = WebSocketWrapper.Create($@"ws://{ip}:{ReceivePort}"); _socket.Connect(); Thread.Sleep(1000); }
public BaseNetworkProtocol(string ip, ushort sendPort, ushort receivePort, int timeout, SocketIo parentSocket) { Setup(ip, sendPort, receivePort, timeout); ParentSocket = parentSocket; }