Пример #1
0
    public bool Connect(string ip, int port, string pwd)
    {
        m_Socket = RakPeerInterface.GetInstance();
        m_Socket.AllowConnectionResponseIPMigration(false);
        SocketDescriptor socketDescriptor = new SocketDescriptor(0, "0");

        socketDescriptor.socketFamily = 2;
        m_Socket.Startup(8, socketDescriptor, 1);
        m_Socket.SetOccasionalPing(true);
        ConnectionAttemptResult car = m_Socket.Connect(ip, (ushort)port, pwd, pwd.Length);

        if (car == ConnectionAttemptResult.CONNECTION_ATTEMPT_STARTED)
        {
            return(true);
        }
        else
        {
            m_Socket.Shutdown(300);
            RakPeerInterface.DestroyInstance(m_Socket);
            return(false);
        }
    }
Пример #2
0
 public RPC(RakPeerInterface peer)
 {
     this.peer = peer;
     peer.AllowConnectionResponseIPMigration(false);
 }