예제 #1
0
        public void Connect(NatNetConnectionType connType,
                            IPAddress localAddress,
                            IPAddress serverAddress,
                            UInt16 serverCommandPort   = NatNetConstants.DefaultCommandPort,
                            UInt16 serverDataPort      = NatNetConstants.DefaultDataPort,
                            IPAddress multicastAddress = null)
        {
            ThrowIfDisposed();

            sNatNetClientConnectParams initParams = new sNatNetClientConnectParams {
                ConnectionType    = connType,
                ServerCommandPort = serverCommandPort,
                ServerDataPort    = serverDataPort,
                LocalAddress      = localAddress.ToString(),
                ServerAddress     = serverAddress.ToString(),
                MulticastAddress  = multicastAddress == null ? null : multicastAddress.ToString()
            };

            NatNetError result;

            result = NatNetLib.NativeMethods.NatNet_Client_Connect(m_clientHandle, ref initParams);
            NatNetException.ThrowIfNotOK(result, "NatNet_Client_Connect failed.");

            result = NatNetLib.NativeMethods.NatNet_Client_GetServerDescription(m_clientHandle, out m_serverDesc);
            NatNetException.ThrowIfNotOK(result, "NatNet_Client_GetServerDescription failed.");

            ServerAppVersion = new Version(
                m_serverDesc.HostAppVersion[0],
                m_serverDesc.HostAppVersion[1],
                m_serverDesc.HostAppVersion[2],
                m_serverDesc.HostAppVersion[3]);

            Connected = true;
        }
예제 #2
0
        public void Connect(IPAddress localAddress,
                            IPAddress serverAddress,
                            UInt16 serverCommandPort   = NatNetConstants.DefaultCommandPort,
                            UInt16 serverDataPort      = NatNetConstants.DefaultDataPort,
                            IPAddress multicastAddress = null)
        {
            ThrowIfDisposed();

            sNatNetClientConnectParams initParams = new sNatNetClientConnectParams {
                LocalAddress      = localAddress.ToString(),
                ServerAddress     = serverAddress.ToString(),
                ServerCommandPort = serverCommandPort,
                ServerDataPort    = serverDataPort,
                MulticastAddress  = multicastAddress == null ? null : multicastAddress.ToString()
            };

            NatNetError retval = NatNetLib.NativeMethods.NatNet_Client_Connect(m_clientHandle, ref initParams);

            NatNetException.ThrowIfNotOK(retval, "NatNet_Client_Connect failed.");

            Connected = true;
        }
예제 #3
0
 public static extern NatNetError NatNet_Client_Connect(IntPtr clientHandle, ref sNatNetClientConnectParams connectParams);