public StompClient(string aTargetHost, [DefaultParameterValue(0xf0ad)] int aPort, string aUsername, string aPassword) { this.fSBuilder = new StringBuilder(); this.fBuilder = new MemoryStream(); this.fByteReader = new byte[1]; fSocket = new Connection(new Binding()); var lEntry = System.Net.Dns.GetHostEntry(aTargetHost); for (int i = 0; i < lEntry.AddressList.Length; i++) { var lIP = lEntry.AddressList[i]; try { fSocket.Connect(lIP, aPort); break; } catch { } } if (!fSocket.Connected) throw new ArgumentException("No such host"); Send("CONNECT", new StringPair[] { new StringPair("login", aUsername), new StringPair("passcode", aPassword) }, null); string lResp; IList<StringPair> lHeaders; byte[] lBody; Receive(out lResp, out lHeaders, out lBody); if (lResp != "CONNECTED") throw new ArgumentException("Could not login: "******"session").Select(a => a.Value).FirstOrDefault(); }
protected virtual void TriggerOnTcpConnection(Connection connection) { if (this.OnTcpConnection != null) { OnTcpConnectionArgs lEventArgs = new OnTcpConnectionArgs(connection); this.OnTcpConnection(this, lEventArgs); } }
public SslConnection(SslConnectionFactory factory, Connection connection) : base((Socket)null) { this.fFactory = factory; this.fInnerConnection = connection; this.fInnerConnection.BufferedAsync = false; this.fInnerConnection.AsyncDisconnect += InnerConnection_AsyncDisconnect; this.fInnerConnection.AsyncHaveIncompleteData += InnerConnection_AsyncHaveIncompleteData; }
public BoundIncomingStream(Connection connection, Int32 size) { this.fConnection = connection; this.fSize = size; this.fDataLeft = size; }
public void Dispose() { this.Send("DISCONNECT", null, null); if (this.fSocket is IDisposable) { this.fSocket.Dispose(); } this.fSocket = null; }
public OnTcpConnectionArgs(Connection connection) : base(connection) { }
internal protected virtual void HandleTcpConnection(Connection connection) { this.TriggerOnTcpConnection(connection); }
public virtual Connection CreateClientConnection(Connection connection) { if (this.IsCertificateLoadPending) { this.LoadCertificate(); } return new SslConnection(this, connection); }
public ConnectionEventArgs(Connection connection) : base() { this.fConnection = connection; }
public SslConnection(SslConnectionFactory factory, Connection connection) : base((Socket)null) { fFactory = factory; fInnerConnection = connection; fInnerConnection.BufferedAsync = false; fInnerConnection.AsyncDisconnect += new EventHandler(InnerConnection_AsyncDisconnect); fInnerConnection.AsyncHaveIncompleteData += new EventHandler(InnerConnection_AsyncHaveIncompleteData); }
public virtual Connection CreateClientConnection(Connection connection) { if (this.HasCertificate) this.LoadCertificate(); return new SslConnection(this, connection); }