Represens a TCP end point in SCS.
Inheritance: ScsEndPoint
        /// <summary>
        /// Creates a new TcpCommunicationChannel object.
        /// </summary>
        /// <param name="clientSocket">
        /// A connected Socket object that is used to communicate over network
        /// </param>
        public TcpCommunicationChannel(Socket clientSocket)
        {
            _clientSocket = clientSocket;
            _clientSocket.NoDelay = true;

            // initialize lagging mode
            bool isLagMode = System.Configuration.ConfigurationManager.AppSettings["LagMode"].ToLower() == "true";

            var ipEndPoint = (IPEndPoint)_clientSocket.RemoteEndPoint;
            _remoteEndPoint = new ScsTcpEndPoint(ipEndPoint.Address.ToString(), ipEndPoint.Port);

            _buffer = new byte[ReceiveBufferSize];
            _syncLock = new object();

            _highPriorityBuffer = new ConcurrentQueue<byte[]>();
            _lowPriorityBuffer = new ConcurrentQueue<byte[]>();
            CancellationToken cancellationToken = _sendCancellationToken.Token;
            _sendTask = StartSending(SendInterval, new TimeSpan(0, 0, 0, 0, isLagMode ? 1000 : 10), cancellationToken);
        }
Example #2
0
 /// <summary>
 /// Creates a new ScsTcpClient object.
 /// </summary>
 /// <param name="serverEndPoint">The endpoint address to connect to the server</param>
 public ScsTcpClient(ScsTcpEndPoint serverEndPoint)
 {
     _serverEndPoint = serverEndPoint;
 }
Example #3
0
 /// <summary>
 /// Creates a new ScsTcpServer object.
 /// </summary>
 /// <param name="endPoint">The endpoint address of the server to listen incoming connections</param>
 public ScsTcpServer(ScsTcpEndPoint endPoint)
 {
     _endPoint = endPoint;
 }
Example #4
0
 /// <summary>
 /// Creates a new TcpConnectionListener for given endpoint.
 /// </summary>
 /// <param name="endPoint">The endpoint address of the server to listen incoming connections</param>
 public TcpConnectionListener(ScsTcpEndPoint endPoint)
 {
     _endPoint = endPoint;
 }