public void Open(string server, int port, bool isSecure, ProxyInfo proxy = null) { if (string.IsNullOrEmpty(server)) { throw new ArgumentNullException("server"); } if (port <= 0 || port > 65535) { throw new ArgumentOutOfRangeException("port"); } if (_socketThread != null) { this.Close(); } _server = server; _port = port; _isSecure = isSecure; _proxy = proxy; _writeQueue = new ConcurrentQueue <IrcMessage>(); _writeWaitHandle = new ManualResetEvent(false); _endWaitHandle = new ManualResetEvent(false); _socketThread = new Thread(new ThreadStart(this.SocketMain)); _socketThread.IsBackground = true; _socketThread.Start(); }
/// <summary> /// Opens the IRC session and attempts to connect to a server. /// </summary> /// <param name="server">The hostname or IP representation of a server.</param> /// <param name="port">The IRC port.</param> /// <param name="isSecure">True to use an encrypted (SSL) connection, false to use plain text.</param> /// <param name="nickname">The desired nickname.</param> /// <param name="userName">The username that will be shown to other users.</param> /// <param name="fullname">The full name that will be shown to other users.</param> /// <param name="autoReconnect">Indicates whether to automatically reconnect upon disconnection.</param> /// <param name="password">The optional password to supply while logging in.</param> /// <param name="invisible">Determines whether the +i flag will be set by default.</param> /// <param name="findExternalAddress">Determines whether to find the external IP address by querying the IRC server upon connect.</param> public void Open(string server, int port, bool isSecure, string nickname, string userName, string fullname, bool autoReconnect, string password = null, bool invisible = false, bool findExternalAddress = true, ProxyInfo proxy = null) { if (string.IsNullOrEmpty(nickname)) { throw new ArgumentNullException("Nickname"); } _password = password; _isInvisible = invisible; _findExternalAddress = findExternalAddress; this.Nickname = nickname; this.Server = server; this.Port = port; this.IsSecure = isSecure; this.Username = userName; this.FullName = fullname; this.NetworkName = this.Server; this.UserModes = new char[0]; this.AutoReconnect = autoReconnect; this.Proxy = proxy; _captures = new List <IrcCodeHandler>(); _conn.Open(server, port, isSecure, this.Proxy); this.State = IrcSessionState.Connecting; }
public SocksTcpClient(ProxyInfo proxy) { _info = proxy; }