public static IUdpSocketTransceiver Create(IExecutorService executorService, UdpSocketTransceiverParameter parameter) { if (parameter.TransceiverType == UdpSocketTransceiverTypes.Tcp) { return(new UdpSocketTransceiverImpl(executorService, parameter)); } return(new UdpSocketTransceiverImpl(executorService, parameter)); }
internal TcpSocketTransceiverImpl(IExecutorService executorService, UdpSocketTransceiverParameter parameter) : base(executorService) { _parameter = parameter; _readBuffer = new byte[Math.Max(256, parameter.ReadBufferSize)]; _writeBuffer = new byte[Math.Max(256, parameter.WriteBufferSize)]; _useInternalQueue = parameter.UseInternalQueue; if (_useInternalQueue) { _queueReceived = ProducerConsumerQueueFactory.Create <UdpSocketReceiveData>(executorService, -1, parameter.ListenWaitTime, false); _queueReceived.Dequeue += this.OnDataReceived; } _remoteEndPoints = new SortedDictionary <IPAddress, EndPoint>(new IPAddressComparer()); }