Beispiel #1
0
        public TcpDataReceiver(string ipAddress, int port, ISocketConsumer consumer)
        {
            var serverAddress = IPAddress.Parse(ipAddress);

            _tcpListener = new TcpListener(serverAddress, port);

            _tcpClientsList = new List <TcpDataClient>();
            _consumer       = consumer;
            _tcpListener.Start();
            Logger.Log(LogStatusEnum.Info, "TCP Listener created in port " + port);
        }
Beispiel #2
0
        public TcpDataClient(Socket clientSocket, ISocketConsumer consumer)
        {
            _clientSocket = clientSocket;
            _consumer     = consumer;
            _stateObject  = new Object();
            _buffer       = new byte[BUFFER_SIZE];

            EndPoint = clientSocket.RemoteEndPoint as IPEndPoint;

            Logger.Log(LogStatusEnum.Info,
                       String.Format("Client {0} connected.",
                                     EndPoint.Address.ToString()));
        }
Beispiel #3
0
 /// <summary>
 /// Creates de Data Receiver UDP Server
 /// </summary>
 /// <param name="port"></param>
 public UdpDataReceiver(int port, ISocketConsumer consumer)
 {
     _udpClient = new UdpClient(port);
     _consumer  = consumer;
     Logger.Log(LogStatusEnum.Info, "UDP Socket created in port " + port);
 }
Beispiel #4
0
 public static void AddRegisterableServices(ISocketConsumer serv)
 {
     _services.Add(serv);
 }