public void ActivateOut() { m_ioObject.SetPollout(m_handle); // Speculative write: The assumption is that at the moment new message // was sent by the user the socket is probably available for writing. // Thus we try to write the data to socket avoiding polling for POLLOUT. // Consequently, the latency should be better in request/reply scenarios. OutEvent(); }
public void Plug(IOThread ioThread, SessionBase session) { Debug.Assert(!m_plugged); m_plugged = true; // Connect to session object. Debug.Assert(m_session == null); Debug.Assert(session != null); m_session = session; m_socket = m_session.Socket; m_ioObject = new IOObject(null); m_ioObject.SetHandler(this); // Connect to I/O threads poller object. m_ioObject.Plug(ioThread); m_ioObject.AddFd(m_handle); // Send the 'length' and 'flags' fields of the identity message. // The 'length' field is encoded in the long format. m_greetingOutputBuffer[m_outsize++] = ((byte)0xff); m_greetingOutputBuffer.PutLong(m_options.Endian, (long)m_options.IdentitySize + 1, 1); m_outsize += 8; m_greetingOutputBuffer[m_outsize++] = ((byte)0x7f); m_outpos = new ByteArraySegment(m_greetingOutputBuffer); m_ioObject.SetPollin(m_handle); m_ioObject.SetPollout(m_handle); // Flush all the data that may have been already received downstream. InEvent(); }
protected override void ProcessPlug() { // Start polling for incoming connections. m_ioObject.SetHandler(this); m_ioObject.AddFd(m_handle); m_ioObject.SetPollin(m_handle); m_ioObject.SetPollout(m_handle); }
// Internal function to start the actual connection establishment. private void StartConnecting() { // Open the connecting socket. try { Open(); // Connect may succeed in synchronous manner. m_handle = m_s; m_ioObject.AddFd(m_handle); m_handleValid = true; m_ioObject.OutEvent(); } catch (NetMQException ex) { if (ex.ErrorCode == ErrorCode.EINPROGRESS) { // Connection establishment may be delayed. Poll for its completion. m_handle = m_s; m_ioObject.AddFd(m_handle); m_handleValid = true; m_ioObject.SetPollout(m_handle); m_socket.EventConnectDelayed(m_endpoint, ex.ErrorCode); } else { // Handle any other error condition by eventual reconnect. if (m_s != null) { Close(); } AddReconnectTimer(); } } }
public void Plug(IOThread ioThread, SessionBase session) { Debug.Assert(!m_plugged); m_plugged = true; // Connect to session object. Debug.Assert(m_session == null); Debug.Assert(session != null); m_session = session; m_socket = m_session.Socket; m_ioObject = new IOObject(null); m_ioObject.SetHandler(this); // Connect to I/O threads poller object. m_ioObject.Plug(ioThread); m_ioObject.AddFd(m_handle); // Send the 'length' and 'flags' fields of the identity message. // The 'length' field is encoded in the long format. m_greetingOutputBuffer[m_outsize++] = ((byte) 0xff); m_greetingOutputBuffer.PutLong((long) m_options.IdentitySize + 1, 1); m_outsize += 8; m_greetingOutputBuffer[m_outsize++] = ((byte) 0x7f); m_outpos = new ByteArraySegment(m_greetingOutputBuffer); m_ioObject.SetPollin(m_handle); m_ioObject.SetPollout(m_handle); // Flush all the data that may have been already received downstream. InEvent(); }