Connect() public static method

NET_Connect called by client to connect to a host. Returns -1 if not able to connect
public static Connect ( string host ) : qsocket_t
host string
return qsocket_t
Example #1
0
        /// <summary>
        /// CL_EstablishConnection
        /// </summary>
        public static void EstablishConnection(string host)
        {
            if (Cls.state == ClientActivityState.Dedicated)
            {
                return;
            }

            if (Cls.demoplayback)
            {
                return;
            }

            Disconnect();

            Cls.netcon = Net.Connect(host);
            if (Cls.netcon == null)
            {
                Host.Error("CL_Connect: connect failed\n");
            }

            Con.DPrint("CL_EstablishConnection: connected to {0}\n", host);

            Cls.demonum = -1;                   // not in the demo loop now
            Cls.state   = ClientActivityState.Connected;
            Cls.signon  = 0;                    // need all the signon messages before playing
        }