Major upgrade
This commit is contained in:
75
Source/Program/Common/Lib/EthernetSocketManager.cs
Normal file
75
Source/Program/Common/Lib/EthernetSocketManager.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// UNCLASSIFIED
|
||||
/*-------------------------------------------------------------------------
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
||||
GOVERNMENT.
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
-------------------------------------------------------------------------*/
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ProgramLib
|
||||
{
|
||||
internal enum TcpClientNames
|
||||
{
|
||||
UUT_TEST_PORT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores global events that any thread can use to wait on
|
||||
/// </summary>
|
||||
internal class EthernetSocketManager
|
||||
{
|
||||
private Dictionary<TcpClientNames, TcpClient> _tcpClientsDict = new Dictionary<TcpClientNames, TcpClient>();
|
||||
|
||||
/// <summary>
|
||||
/// The private constructor
|
||||
/// </summary>
|
||||
public EthernetSocketManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~EthernetSocketManager()
|
||||
{
|
||||
foreach (KeyValuePair<TcpClientNames, TcpClient> item in _tcpClientsDict)
|
||||
{
|
||||
item.Value.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Tcp Client Socket
|
||||
/// </summary>
|
||||
public TcpClient GetTcpClient(TcpClientNames tcpClientName)
|
||||
{
|
||||
TcpClient tcpClient = null;
|
||||
|
||||
if (_tcpClientsDict.ContainsKey(tcpClientName))
|
||||
tcpClient = _tcpClientsDict[tcpClientName];
|
||||
|
||||
return tcpClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add Tcp Client Socket
|
||||
/// </summary>
|
||||
public void AddTcpClient(TcpClientNames tcpClientName, TcpClient tcpClient)
|
||||
{
|
||||
if (!_tcpClientsDict.ContainsKey(tcpClientName))
|
||||
_tcpClientsDict[tcpClientName] = tcpClient;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user