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); }
internal void Listen(int port) { var udpClient = new UdpClient(port); while (true) { ITransportHeaders requestHeaders; Stream requestStream; IPEndPoint remote; var transport = new UdpTransport(udpClient); transport.Read(out requestHeaders, out requestStream, out remote); ThreadPool.QueueUserWorkItem(s => ProcessMessage(remote, requestHeaders, requestStream)); } }
internal void Listen(int port) { var udpClient = new UdpClient(port); while (true) { ITransportHeaders requestHeaders; Stream requestStream; IPEndPoint remote; var transport = new UdpTransport(udpClient); transport.Read(out requestHeaders, out requestStream, out remote); ThreadPool.QueueUserWorkItem(s => ProcessMessage(remote, requestHeaders, requestStream)); } }
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); }