コード例 #1
0
 public UdpClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
 {
     ChannelName        = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority    = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     ClientSinkProvider = provider ?? UdpChannelHelper.CreateClientSinkProvider();
     SetupClientProviderChain(ClientSinkProvider, new UdpClientChannelSinkProvider());
 }
コード例 #2
0
 public UdpServerChannel(IDictionary properties, IServerChannelSinkProvider provider)
 {
     ChannelName        = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority    = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     MachineName        = properties.GetValue("machineName", Dns.GetHostName());
     Port               = properties.GetValue("port", UdpChannelHelper.DefaultPort);
     ChannelDataStore   = UdpChannelHelper.CreateChannelDataStore(MachineName, Port);
     ServerSinkProvider = provider ?? UdpChannelHelper.CreateServerSinkProvider();
     SetupServerSinkChain(ServerSinkProvider);
     StartListening(null);
 }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 public string Parse(string url, out string objectURI)
 {
     return(UdpChannelHelper.Parse(url, out objectURI));
 }