// Create the socket connection to the server if necessary private bool setupConnection() { // If an error occurred last time through, or if the server closed the connection, close our end if ((_connectionState != ConnectionState.NO_CONNECTION && _connectionState != ConnectionState.IDLE) || _eof) { close(); } _eof = false; if (_connectionState == ConnectionState.NO_CONNECTION) { if (!doConnect()) { return(false); } } // Prepare to write the request _connectionState = ConnectionState.WRITE_REQUEST; _bytesWritten = 0; // Notify the dispatcher to listen on this source (calls handleEvent when the socket is writable) _disp.RemoveSource(this); // Make sure nothing is left over _disp.AddSource(this, XmlRpcDispatch.EventType.WritableEvent | XmlRpcDispatch.EventType.Exception); return(true); }
public override void addToDispatch(XmlRpcDispatch disp) { if (disp == null) return; if (check()) return; disp.AddSource(client, (XmlRpcDispatch.EventType.WritableEvent | XmlRpcDispatch.EventType.Exception)); }