public NetworkSocket(int processId, UInt32 protocolType, IPAddress localAddress, UInt16 localPort, IPAddress remoteAddress, UInt16 remotePort) { guid = Guid.NewGuid(); Stats = new NetworkStats(); ProcessId = processId; ProtocolType = protocolType; LocalAddress = localAddress; LocalPort = localPort; RemoteAddress = remoteAddress; RemotePort = remotePort; HashID = NetworkSocket.MkHash(ProcessId, ProtocolType, LocalAddress, LocalPort, RemoteAddress, RemotePort); }
private NetworkSocket FindSocket(MultiValueDictionary <UInt64, NetworkSocket> List, int ProcessId, UInt32 ProtocolType, IPAddress LocalAddress, UInt16 LocalPort, IPAddress RemoteAddress, UInt16 RemotePort, NetworkSocket.MatchMode Mode) { UInt64 HashID = NetworkSocket.MkHash(ProcessId, ProtocolType, LocalAddress, LocalPort, RemoteAddress, RemotePort); List <NetworkSocket> Matches = List.GetValues(HashID, false); if (Matches != null) { foreach (NetworkSocket CurSocket in Matches) { if (CurSocket.Match(ProcessId, ProtocolType, LocalAddress, LocalPort, RemoteAddress, RemotePort, Mode)) { return(CurSocket); } } } return(null); }