Esempio n. 1
0
        /// <summary>
        /// Connects to a server
        /// </summary>
        /// <param name="host">Hostname or IP address</param>
        /// <param name="port">Port</param>
        /// <returns>A connected FlicClient</returns>
        /// <exception cref="System.Net.Sockets.SocketException">If a connection couldn't be established</exception>
        public static async Task <FlicClient> CreateAsync(string host, int port)
        {
            var tcpClient = new TcpClient();

            tcpClient.NoDelay = true;
            await tcpClient.ConnectAsync(host, port);

            var client = new FlicClient();

            client._tcpClient = tcpClient;
            client._socket    = tcpClient.Client;
            return(client);
        }
Esempio n. 2
0
        /// <summary>
        /// Connects to a server
        /// </summary>
        /// <param name="host">Hostname or IP address</param>
        /// <param name="port">Port</param>
        /// <returns>A connected FlicClient</returns>
        /// <exception cref="System.Net.Sockets.SocketException">If a connection couldn't be established</exception>
        public static FlicClient Create(string host, int port)
        {
            var tcpClient = new TcpClient();

            tcpClient.NoDelay = true;
            tcpClient.Connect(host, port);

            var client = new FlicClient();

            client._tcpClient = tcpClient;
            client._socket    = tcpClient.Client;
            return(client);
        }