Example #1
0
 public HttpRequest(IHttpTransaction transaction, ITcpSocket stream)
     : base(transaction.Context)
 {
     Transaction = transaction;
     Socket = stream;
     RemoteAddress = stream.RemoteEndpoint.Address.ToString();
     RemotePort = stream.RemoteEndpoint.Port;
 }
Example #2
0
        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);
        }
Example #3
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));
 }
Example #5
0
        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));
 }
Example #8
0
 /// <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);
 }
Example #9
0
 public ReceivedGenericEventArgs(ITcpSocket socket, T generic)
 {
     Socket  = socket;
     Generic = generic;
 }
Example #10
0
 public void Data(ITcpSocket socket, byte[] data, string message = "Data")
 {
     Write(LogLevel.Info, $"{socket.Identity} {message}{Environment.NewLine}{Util.HexDump(data)}", data);
 }
Example #11
0
 public void Packet(ITcpSocket socket, BafPacket packet)
 {
     Write(LogLevel.Info, $"{socket.Identity}{Environment.NewLine}{packet.AsString()}", packet);
 }
Example #12
0
 protected void OnClientConnected(ITcpSocket socket)
 {
     _consumer.OnClientConnected(socket);
 }
Example #13
0
 protected void OnReceivedData(ITcpSocket socket, byte[] data)
 {
     _consumer.OnReceivedData(socket, data);
 }
Example #14
0
        public static HttpTransaction BeginTransaction(HttpServer server, ITcpSocket socket, HttpConnectionCallback cb,
                                                       bool closeOnEnd = false)
        {
            var transaction = new HttpTransaction(server, socket, cb, closeOnEnd);

            return transaction;
        }
Example #15
0
 /// <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;
 }
Example #16
0
 /// <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;
 }
Example #17
0
        public static HttpTransaction BeginTransaction(HttpServer server, ITcpSocket socket, HttpConnectionCallback cb, bool closeOnEnd = false)
        {
            HttpTransaction transaction = new HttpTransaction(server, socket, cb, closeOnEnd);

            return(transaction);
        }
Example #18
0
 /// <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;
 }
Example #19
0
 public void Debug(ITcpSocket socket, string message)
 {
     Debug($"[{socket.Identity}] {message}");
 }
 protected abstract void HandleReceived(ITcpSocket socket, byte[] data);
Example #21
0
 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));
 }
Example #23
0
 public void Info(ITcpSocket socket, string message)
 {
     Info($"[{socket.Identity}] {message}");
 }
Example #24
0
        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;
            }
        }
Example #25
0
 /// <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;
 }
Example #27
0
 /// <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);
 }
Example #28
0
 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));
 }