public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders requestHeaders, Stream requestStream) { // add message Uri to headers var mcm = (IMethodCallMessage)msg; requestHeaders[CommonTransportKeys.RequestUri] = mcm.Uri; // send data (FIXME: 1) add reliability, 2) handle exceptions) var transport = new UdpTransport(UdpClient); transport.Write(requestHeaders, requestStream, ServerEndpoint); // if the call is not one-way, schedule an async call if (!RemotingServices.IsOneWay(mcm.MethodBase)) { ThreadPool.QueueUserWorkItem((s) => { try { ITransportHeaders responseHeaders; Stream responseStream; IPEndPoint remote; transport.Read(out responseHeaders, out responseStream, out remote); sinkStack.AsyncProcessResponse(responseHeaders, responseStream); } catch (Exception ex) { sinkStack.DispatchException(ex); } }); } }
public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders requestHeaders, Stream requestStream) { // add message Uri to headers var mcm = (IMethodCallMessage)msg; requestHeaders[CommonTransportKeys.RequestUri] = mcm.Uri; // send data (FIXME: 1) add reliability, 2) handle exceptions) var transport = new UdpTransport(UdpClient); transport.Write(requestHeaders, requestStream, ServerEndpoint); // if the call is not one-way, schedule an async call if (!RemotingServices.IsOneWay(mcm.MethodBase)) { ThreadPool.QueueUserWorkItem((s) => { try { ITransportHeaders responseHeaders; Stream responseStream; IPEndPoint remote; transport.Read(out responseHeaders, out responseStream, out remote); sinkStack.AsyncProcessResponse(responseHeaders, responseStream); } catch (Exception ex) { sinkStack.DispatchException(ex); } }); } }
public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream) { // add message Uri to headers var mcm = (IMethodCallMessage)msg; requestHeaders[CommonTransportKeys.RequestUri] = mcm.Uri; // send data and receive reply (FIXME: 1) add reliability, 2) handle exceptions) IPEndPoint remote; var transport = new UdpTransport(UdpClient); transport.Write(requestHeaders, requestStream, ServerEndpoint); transport.Read(out responseHeaders, out responseStream, out remote); }
void ProcessMessage(IPEndPoint remote, ITransportHeaders requestHeaders, Stream requestStream) { // parse request uri var url = requestHeaders[CommonTransportKeys.RequestUri].ToString(); string objectUri; UdpChannelHelper.Parse(url, out objectUri); objectUri = objectUri ?? url; requestHeaders[CommonTransportKeys.RequestUri] = objectUri; IMessage responseMsg; ITransportHeaders responseHeaders; Stream responseStream; // process message var stack = new ServerChannelSinkStack(); stack.Push(this, null); var operation = NextChannelSink.ProcessMessage(stack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream); switch (operation) { case ServerProcessing.Complete: stack.Pop(this); var transport = new UdpTransport(new UdpClient()); transport.Write(responseHeaders, responseStream, remote); break; case ServerProcessing.Async: stack.StoreAndDispatch(NextChannelSink, null); break; case ServerProcessing.OneWay: break; } }
void ProcessMessage(IPEndPoint remote, ITransportHeaders requestHeaders, Stream requestStream) { // parse request uri var url = requestHeaders[CommonTransportKeys.RequestUri].ToString(); string objectUri; UdpChannelHelper.Parse(url, out objectUri); objectUri = objectUri ?? url; requestHeaders[CommonTransportKeys.RequestUri] = objectUri; IMessage responseMsg; ITransportHeaders responseHeaders; Stream responseStream; // process message var stack = new ServerChannelSinkStack(); stack.Push(this, null); var operation = NextChannelSink.ProcessMessage(stack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream); switch (operation) { case ServerProcessing.Complete: stack.Pop(this); var transport = new UdpTransport(new UdpClient()); transport.Write(responseHeaders, responseStream, remote); break; case ServerProcessing.Async: stack.StoreAndDispatch(NextChannelSink, null); break; case ServerProcessing.OneWay: break; } }
public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream) { // add message Uri to headers var mcm = (IMethodCallMessage)msg; requestHeaders[CommonTransportKeys.RequestUri] = mcm.Uri; // send data and receive reply (FIXME: 1) add reliability, 2) handle exceptions) IPEndPoint remote; var transport = new UdpTransport(UdpClient); transport.Write(requestHeaders, requestStream, ServerEndpoint); transport.Read(out responseHeaders, out responseStream, out remote); }