/// <summary> /// Creates a new telnet server /// </summary> /// <param name="Socket">The socket</param> public TelnetServer(SimpleSocket Socket) { this._Sock = Socket; this.EchoEnabled = true; // We handle our line endings ourself this._Sock.LineEnding = ""; }
public override void ConnectToSocket(string hostName, ushort port) { this.HostName = hostName; this.Port = port; this.socket = new WiFlySocket(hostName, port, this.wf_module); this.socket.Connect(); }
/// <summary> /// Initializes a mail client /// </summary> /// <param name="Socket">The socket to use (default TCP port for POP3 is 110)</param> /// <param name="Username">Username for the POP3 server</param> /// <param name="Password">Password for the POP3 server</param> public POP3_Client(SimpleSocket Socket, string Username, string Password) { // Copies all parameters to the global scope this._Socket = Socket; this._POP3_User = Username; this._POP3_Pass = Password; // Defines that we use line endings with the linefeed character this._Socket.LineEnding = "\n"; }
public override void DisconnectFromSocket() { this.HostName = default(string); this.Port = default(ushort); this.wf_module.CloseSocket(); if (this.socket != null) { this.socket.Close(); this.socket = null; } }
/// <summary> /// Connects to an IRC server /// </summary> /// <param name="Socket">The socket to use</param> /// <param name="Nickname">Nickname</param> /// <param name="Username">Username (optional)</param> /// <param name="Fullname">Full name (optional)</param> /// <param name="Password">Password to connect to the server (optional)</param> public IRC_Client(SimpleSocket Socket, string Nickname, string Username = "", string Fullname = "", string Password = "") { // What kind of device do we run on? string[] SocketProvider = Socket.ToString().Split(new char[] { '.' }); string[] Client = this.ToString().Split(new char[] { '.' }); // Version this._ClientVersion = "NETMFToolbox/0.1 (" + Tools.HardwareProvider + "; " + SocketProvider[SocketProvider.Length - 1] + "; " + Client[Client.Length - 1] + ")"; // Stores all fields this._Socket = Socket; this._Nickname = Nickname; this._Username = (Username == "") ? Nickname : Username; this._Fullname = (Fullname == "") ? this._ClientVersion : Fullname; this._Password = Password; this._ServerName = Socket.Hostname; // Configures the socket this._Socket.LineEnding = "\n"; // Creates a new background thread this._LoopThread = new Thread(new ThreadStart(this._Loop)); }
/// <summary> /// Initializes a mail sender /// </summary> /// <param name="Socket">The socket to use (default TCP port for SMTP is 25)</param> /// <param name="AuthenticationType">The form of SMTP Authentication (default: no authentication)</param> /// <param name="Username">Username for the SMTP server (when using authentication)</param> /// <param name="Password">Password for the SMTP server (when using authentication)</param> public SMTP_Client(SimpleSocket Socket, AuthenticationTypes AuthenticationType = AuthenticationTypes.None, string Username = "", string Password = "") { // Copies all parameters to the global scope this._Socket = Socket; this._SMTP_User = Username; this._SMTP_Pass = Password; this._SMTP_Auth = AuthenticationType; // By default we fill the hostname with the name of the hardware itself. We need this to identify ourself string Hostname = Tools.HardwareProvider.ToString(); int LastDot = Hostname.LastIndexOf('.'); if (LastDot > 0) this._LocalHostname = Hostname.Substring(0, LastDot); else this._LocalHostname = Hostname; }
/// <summary> /// Initializes a new Shell core /// </summary> /// <param name="Socket">Socket to use</param> public ShellCore(SimpleSocket Socket) { this.TelnetServer = new TelnetServer(Socket); this.Prompt = ">"; }
public override void SendData(string data) { if (this.socket == null || data == null) { throw new NullReferenceException(); } try { byte[] cmdBytes = Encoding.UTF8.GetBytes(data + "\r\n"); this.socket.SendBinary(cmdBytes); } catch (ObjectDisposedException e) { this.socket = null; throw new NullReferenceException(); } }
/// <summary> /// Creates a connection to a NTP server /// </summary> /// <param name="Socket">The socket to use (default UDP port for NTP is 123)</param> public SNTP_Client(SimpleSocket Socket) { this._Socket = Socket; }
/// <summary> /// Creates a connection to a NTP server /// </summary> /// <param name="Socket">The socket to use (default UDP port for NTP is 123)</param> public SNTP_Client(SimpleSocket Socket) { this._Socket = Socket; }
/// <summary> /// Initializes a web session /// </summary> /// <param name="Socket">The socket to use (default TCP port for HTTP is 80)</param> public HTTP_Client(SimpleSocket Socket) { this._Socket = Socket; this.Accept = "*/*"; this.AcceptLanguage = "en"; // What kind of device do we run on? string[] SocketProvider = Socket.ToString().Split(new char[] { '.' }); string[] Client = this.ToString().Split(new char[] { '.' }); // User Agent this.UserAgent = "NETMFToolbox/0.1 (textmode; " + Tools.HardwareProvider + "; " + SocketProvider[SocketProvider.Length - 1] + "; " + Client[Client.Length - 1] + ")"; // No referrer yet this.Referrer = ""; }