예제 #1
0
        void Init(IServerChannelSinkProvider serverSinkProvider)
        {
            if (serverSinkProvider == null)
            {
                serverSinkProvider = new BinaryServerFormatterSinkProvider();
            }

            if (host == null)
            {
                if (useIpAddress)
                {
                    if (!bindAddress.Equals(IPAddress.Any))
                    {
                        host = bindAddress.ToString();
                    }
                    else
                    {
                        IPHostEntry he = Dns.Resolve(Dns.GetHostName());
                        if (he.AddressList.Length == 0)
                        {
                            throw new RemotingException("IP address could not be determined for this host");
                        }
                        host = he.AddressList [0].ToString();
                    }
                }
                else
                {
                    host = Dns.GetHostByName(Dns.GetHostName()).HostName;
                }
            }

            // Gets channel data from the chain of channel providers

            channel_data = new ChannelDataStore(null);
            IServerChannelSinkProvider provider = serverSinkProvider;

            while (provider != null)
            {
                provider.GetChannelData(channel_data);
                provider = provider.Next;
            }

            // Creates the sink chain that will process all incoming messages

            IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain(serverSinkProvider, this);

            sink = new TcpServerTransportSink(next_sink);
        }
예제 #2
0
 public ClientConnection(TcpServerChannel serverChannel, Socket socket, TcpServerTransportSink sink)
 {
     _socket = socket;
     _sink   = sink;
     _id     = _count++;
 }