This is written in C#
Imagine this scenario.
I have a socket server service running on a computer. A lot of other processes on the same computer will be creating connections and sending requests to this server.
I want to collect these requests in a dictionary, and send them to an API over the internet, as i don't want to send them one at a time.
From the API i get a response for each of these requests in a dictionary, and here comes the question.
How do i return the proper responses to the right processes ?
I'm thinking there must be some way of identifying the process a request comes from, and then i could store that identifier together with the request, and then find that request again and use the identifier to send the proper response. But how :)
Thankyou beforehand for helping me :)
CodePudding user response:
The combination of:
SrcIP, SrcPort, DstIP, DstPort
Is always globally unique. No connection on any machine will ever be the same as any other connection.
So you can use this as your index if you're not framing a unique GUID into your protocol.