fCraft.IRC.IrcThread.Connect C# (CSharp) Method

Connect() private method

private Connect ( ) : void
return void
            void Connect() {
                // initialize the client
                IPAddress ipToBindTo = IPAddress.Parse(ConfigKey.IP.GetString());
                IPEndPoint localEndPoint = new IPEndPoint(ipToBindTo, 0);
                client = new TcpClient(localEndPoint) {
                    NoDelay = true,
                    ReceiveTimeout = (int)Timeout.TotalMilliseconds,
                    SendTimeout = (int)Timeout.TotalMilliseconds
                };
                client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);

                // connect
                client.Connect(hostName, port);

                // prepare to read/write
                reader = new StreamReader(client.GetStream(), Encoding, false);
                writer = new StreamWriter(client.GetStream(), Encoding, 512);
                isConnected = true;
            }