Now, in my project, I have to write the data from different ipaddresses into separate lists. I am having a problem in how I will record in what order.
The number of connections can be 500. The user can close and open connections as they wish. In case he closes the connection, no registration should be made for that list.
For example; The ip address 192.168.1.20 - 192.168.1.30 - 192.168.1.40 is three connections. I know from which ip address the data comes from but I cannot control which list I should write the data to.
I have 3 lists named Log_1 Log_2 Log_3. In case of opening the connection, I can record respectively. When he closes the 2nd connection and then reconnects, the queue will be shifted and this will make my administration difficult. How can I get out of this situation?
To summarize; I need to keep the data from each ip in separate lists. It must be able to support up to 500 connections.
I used "ConcurrentDictionary" but ConcurrentDictionary does not add when data comes from the same key. Is there an alternative? Or am I making a mistake somewhere.
My Code
ConcurrentDictionary<string, Queue<byte[]>> FullData = new ConcurrentDictionary<string, Queue<byte[]>>();
DataReceived Code
byte[] Data = e.Data;
FullData.TryAdd(e.IpPort, Data);