Beispiel #1
0
        private void PortManager_IncomingRequest(NetworkStream channel, IPEndPoint local, IPEndPoint remote)
        {
            IHandler[] handlers = PortManager.ListHandlersOnPort(local.Port);

            // Read first line of request if the port is shared.
            if (handlers[0] is ISharingHandler && handlers.Length > 1)
            {
                string firstLine = StreamHelps.ReadLine(channel);
                foreach (ISharingHandler handler in handlers)
                {
                    if (handler.CanProcessRequest(firstLine.ToString()))
                    {
                        handler.HandleRequest(channel, firstLine.ToString(), local, remote);
                        break;
                    }
                }
            }
            else             // non-sharing port
            {
                handlers[0].HandleRequest(channel, local, remote);
            }
        }
Beispiel #2
0
 public void HandleRequest(NetworkStream stream, IPEndPoint local, IPEndPoint remote)
 {
     HandleRequest(stream, StreamHelps.ReadLine(stream), local, remote);
 }