Esempio n. 1
0
        public override void Connect(int localPort, string remoteHost, int remotePort)
        {
            if (_client != null)
            {
                Close();
            }

            _localEndPoint  = OSCStandaloneManager.CreateLocalEndPoint(localPort);
            _remoteEndPoint = OSCStandaloneManager.CreateRemoteEndPoint(remoteHost, remotePort);

            try
            {
                _client = OSCStandaloneManager.CreateClient(_localEndPoint);
            }
            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
                {
                    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();
            }
        }
Esempio n. 2
0
 public override void RefreshConnection(string remoteHost, int remotePort)
 {
     _remoteEndPoint = OSCStandaloneManager.CreateRemoteEndPoint(remoteHost, remotePort);
 }