public override void Connect(string localHost, int localPort) { if (_client != null) { Close(); } try { _client = OSCStandaloneManager.Create(localHost, localPort); _controllerThreadAsync = new AsyncCallback(ControllerThread); _client.BeginReceive(_controllerThreadAsync, _client); _isRunning = true; } catch (SocketException e) { if (e.ErrorCode == 10048) { Debug.LogErrorFormat("[OSCReceiver] Socket Error: Could not use port {0} because another application is listening on it.", localPort); } else if (e.ErrorCode == 10049) { Debug.LogErrorFormat("[OSCReceiver] Socket Error: Could not use local host \"{0}\". Cannot assign requested address.", localHost); } else { Debug.LogErrorFormat("[OSCReceiver] Socket Error: Error Code {0}.\n{1}", e.ErrorCode, e.Message); } Close(); } catch (ArgumentOutOfRangeException) { Debug.LogErrorFormat("[OSCReceiver] Invalid port: {0}", localPort); Close(); } catch (Exception e) { Debug.LogErrorFormat("[OSCReceiver] Error: {0}", e); Close(); } }
public override void Connect(string localHost, int localPort) { if (_client != null) { Close(); } try { _client = OSCStandaloneManager.Create(localHost, localPort); } catch (SocketException e) { if (e.ErrorCode == 10048) { Debug.LogErrorFormat("[OSCTransmitter] Socket Error: Could not use local port {0} because another application is listening on it.", localPort); } else if (e.ErrorCode == 10049) { Debug.LogErrorFormat("[OSCTransmitter] Socket Error: Could not use local host \"{0}\". Cannot assign requested address.", localHost); } else { Debug.LogErrorFormat("[OSCTransmitter] Socket Error: Error Code {0}.\n{1}", e.ErrorCode, e.Message); } Close(); } catch (ArgumentOutOfRangeException) { Debug.LogErrorFormat("[OSCTransmitter] Invalid port: {0}", localPort); Close(); } catch (Exception e) { Debug.LogErrorFormat("[OSCTransmitter] Error: {0}", e); Close(); } }