I am using TcpListener
(Clase) example https://msdn.microsoft.com/es-es/library/system.net.sockets.tcplistener(v=vs.110).aspx in order to process TCP requests.
But It seems like at the same time this TCP Listener
is gonna accept multiple requests that should be processed later in a couple of Web Services
together and result must be returned to the TCP client
.
I am thinking to do following:
Get a stream object for reading and writing
NetworkStream stream = client.GetStream();
and save it in special container class.Put this class to special
Queue
helper class like this one C#: Triggering an Event when an object is added to a Queue.When
Queue
is changed fire implemented event to process the next queue item asynchronously usingTask
.Within a
Task
communicate withWeb Services
, and send the response toTCP Client
.
Please, let me know this architecture is vital and able to resolve the multiple requests to TCP Listener
.