public HttpRequest(IHttpTransaction transaction, ITcpSocket stream) : base(transaction.Context) { Transaction = transaction; Socket = stream; RemoteAddress = stream.RemoteEndpoint.Address.ToString(); RemotePort = stream.RemoteEndpoint.Port; }
public Response(IO.Context context, IRequest request, ITcpSocket socket) : base(context) { Request = request; Socket = socket; StatusCode = 200; WriteHeaders = true; Stream = new Stream (this, socket.GetSocketStream ()); Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0); }
public Transaction(Server server, ITcpSocket socket, ConnectionCallback callback, bool closeOnEnd = false) { Server = server; Socket = socket; this.closeOnEnd = closeOnEnd; Context = server.Context; ConnectionCallback = callback; gc_handle = GCHandle.Alloc(this); Request = new Request(this, socket); Request.Read(Close); }
public void OnClientConnected(ITcpSocket socket) { ClientEvents.Add(new ClientEvent(socket, ClientEventType.Connected)); }
public static Transaction BeginTransaction(Server server, ITcpSocket socket, ConnectionCallback cb, bool closeOnEnd = false) { Transaction transaction = new Transaction(server, socket, cb, closeOnEnd); return transaction; }
protected abstract void HandleConnected(ITcpSocket socket);
void IConsumer.OnClientConnected(ITcpSocket socket) { _queues[socket.UnitOfOrder].Add(new ClientEvent(socket, ClientEventType.Connected)); }
/// <summary> /// Initializes a new instance of the <see cref="AdbSocket"/> class. /// </summary> /// <param name="endPoint"> /// The <see cref="EndPoint"/> at which the Android Debug Bridge is listening /// for clients. /// </param> public AdbSocket(EndPoint endPoint) { this.socket = new TcpSocket(); this.socket.Connect(endPoint); }
public ReceivedGenericEventArgs(ITcpSocket socket, T generic) { Socket = socket; Generic = generic; }
public void Data(ITcpSocket socket, byte[] data, string message = "Data") { Write(LogLevel.Info, $"{socket.Identity} {message}{Environment.NewLine}{Util.HexDump(data)}", data); }
public void Packet(ITcpSocket socket, BafPacket packet) { Write(LogLevel.Info, $"{socket.Identity}{Environment.NewLine}{packet.AsString()}", packet); }
protected void OnClientConnected(ITcpSocket socket) { _consumer.OnClientConnected(socket); }
protected void OnReceivedData(ITcpSocket socket, byte[] data) { _consumer.OnReceivedData(socket, data); }
public static HttpTransaction BeginTransaction(HttpServer server, ITcpSocket socket, HttpConnectionCallback cb, bool closeOnEnd = false) { var transaction = new HttpTransaction(server, socket, cb, closeOnEnd); return transaction; }
/// <summary> /// Initializes a new instance of the <see cref="AdbSocket"/> class. /// </summary> /// <param name="socket"> /// The <see cref="ITcpSocket"/> at which the Android Debug Bridge is listening /// for clients. /// </param> public AdbSocket(ITcpSocket socket) { this.socket = socket; }
/// <summary> /// Initializes a new instance of the <see cref="AdbSocket"/> class. /// </summary> /// <param name="endPoint"> /// The <see cref="EndPoint"/> at which the Android Debug Bridge is listening /// for clients. /// </param> public AdbSocket(EndPoint endPoint) { this.socket = new TcpSocket(); this.socket.Connect(endPoint); this.socket.ReceiveBufferSize = ReceiveBufferSize; }
public static HttpTransaction BeginTransaction(HttpServer server, ITcpSocket socket, HttpConnectionCallback cb, bool closeOnEnd = false) { HttpTransaction transaction = new HttpTransaction(server, socket, cb, closeOnEnd); return(transaction); }
public void Debug(ITcpSocket socket, string message) { Debug($"[{socket.Identity}] {message}"); }
protected abstract void HandleReceived(ITcpSocket socket, byte[] data);
public void Error(ITcpSocket socket, string message) { Error($"[{socket.Identity}] {message}"); }
void IConsumer.OnReceivedData(ITcpSocket socket, byte[] data) { _queues[socket.UnitOfOrder].Add(new ClientEvent(socket, ClientEventType.ReceivedData, data)); }
public void Info(ITcpSocket socket, string message) { Info($"[{socket.Identity}] {message}"); }
public void Close() { if (!responseFinished) { wantClose = true; } else { if (gc_handle.IsAllocated) gc_handle.Free(); if (Request != null) Request.Dispose(); if (Response != null) Response.Dispose(); Socket = null; Request = null; Response = null; } }
/// <summary> /// Initializes a new instance of the <see cref="AdbSocket"/> class. /// </summary> /// <param name="socket"> /// The <see cref="ITcpSocket"/> at which the Android Debug Bridge is listening /// for clients. /// </param> public AdbSocket(ITcpSocket socket) { this.socket = socket; this.logger = NullLogger <AdbSocket> .Instance; }
public DisconnectedEventArgs(ITcpSocket socket) { Socket = socket; }
private void ConnectionAccepted(ITcpSocket socket) { HttpTransaction t = HttpTransaction.BeginTransaction(this, socket, callback, closeOnEnd); }
public void OnReceivedData(ITcpSocket socket, byte[] data) { ClientEvents.Add(new ClientEvent(socket, ClientEventType.ReceivedData, data)); }