public PgmReceiver(string address, int port, ISourceReader reader) { _socket = new PgmSocket(); _ip = address; _port = port; _reader = reader; }
public void Start() { IPAddress ipAddr = IPAddress.Parse(_ip); IPEndPoint end = new IPEndPoint(ipAddr, _port); _socket.SendBufferSize = _sendSocketSize; IPAddress local = IPAddress.Any; if (_bindInterface != null) { local = IPAddress.Parse(_bindInterface); } _socket.Bind(new IPEndPoint(local, _bindPort)); SetSendWindow(); PgmSocket.EnableGigabit(_socket); _socket.ApplySocketOptions(); _socket.Connect(end); }
public void Start() { _socket.ReceiveBufferSize = _receiveBufferInBytes; IPAddress ipAddr = IPAddress.Parse(_ip); IPEndPoint end = new IPEndPoint(ipAddr, _port); _socket.Bind(end); foreach (uint address in _interfaceAddresses) { byte[] bits = BitConverter.GetBytes(address); _socket.SetPgmOption(PgmConstants.RM_ADD_RECEIVE_IF, bits); } _socket.ApplySocketOptions(); PgmSocket.EnableGigabit(_socket); _socket.Listen(5); log.Info("Listening: " + end); _socket.BeginAccept(OnAccept, null); }
public void AcceptSocket(Socket receiveSocket, IAcceptor acceptor) { try { IByteParser parser = _parserFactory.Create(receiveSocket); PgmSocket.EnableGigabit(receiveSocket); if (_receiveBufferSize > 0) { receiveSocket.ReceiveBufferSize = _receiveBufferSize; } byte[] buffer = new byte[_readBuffer]; AsyncReader reader = new AsyncReader(parser, buffer, acceptor, this, receiveSocket); reader.BeginReceive(); }catch (Exception failed) { receiveSocket.Close(); log.Error("BeginReceive Failed", failed); } }
public PgmSource(string address, int port) { _socket = new PgmSocket(); _ip = address; _port = port; }