/// <summary> /// TCP server constuctor, this instanciate the server on the specified port. /// </summary> /// <param name="Port"></param> /// <param name="aTransmittedCBHandler"></param> /// <param name="aReceivedCBHandler"></param> /// <param name="aClientFoundCBHandler"></param> /// <param name="aClientLostCBHandler"></param> public TCPServer(int Port, TransmittedCBType aTransmittedCBHandler, ReceivedCBType aReceivedCBHandler, ClientFoundCBType aClientFoundCBHandler, ClientLostCBType aClientLostCBHandler) { this.tcpListener = new TcpListener(IPAddress.Any, Port); this.ServerListeningThread = new Thread(new ThreadStart(ServerListeningThreadHandler)); this.aReceivedCBHandler = aReceivedCBHandler; this.aTransmittedCBHandler = aTransmittedCBHandler; this.aClientFoundCBHandler = aClientFoundCBHandler; this.aClientLostCBHandler = aClientLostCBHandler; //start server listening thread this.ServerListeningThread.Start(); }