private void CreateConnection() { var sock = new RpcTcpSocketConnection(RpcConnectionDirection.Client); sock.Disconnected += new Action <RpcTcpSocketConnection>( (s) => { _parent.OnSubDisconnected(); } ); sock.RequestReceived += new Action <RpcTcpSocketConnection, int, RpcRequest>( (s, seq, request) => { // TODO // Not support this response } ); sock.ResponseReceived += new Action <RpcTcpSocketConnection, int, RpcResponse>( (s, seq, response) => { RpcTcpTransactionManager.EndTransaction(seq, response); } ); // // Auto Connect sock.BeginConnect( (TcpUri)_parent.RemoteUri, delegate(Exception ex) { if (ex != null) { _retryBegin = DateTime.Now.AddSeconds(1); } else { _parent.OnSubConnected(); } }, false ); _sock = sock; }
public override void BeginConnect(Action <Exception> callback) { _socket.BeginConnect((TcpUri)RemoteUri, callback, true); }