Exemple #1
0
    void Init (IServerChannelSinkProvider provider) {
      if (!_e.Incoming)
        throw new InvalidOperationException("Non-listening Endpoint passed to IceServerChannel");

      if (!(_e is TcpEndpoint))
        throw new NotSupportedException("Only TcpEndpoints are supported as servers (for now)");

      if (provider == null) {
        provider = new IceServerFormatterSinkProvider();
      }

      IServerChannelSink nextSink = ChannelServices.CreateServerChannelSinkChain (provider, this);

      TcpEndpoint te = _e as TcpEndpoint;

      string[] uris = null;
      if (te.port != 0) {
        uris = new string[1];
        uris[0] = "ice://" + te.host + ":" + te.port;
      }

      _channelData = new ChannelDataStore (uris);
      _channelData["__iceEndpoint"] = _e;

      _sink = new IceServerTransportSink (nextSink);
      //      _listener = new TcpListener (te.IPAddress, te.port);
      _listener = new TcpListener (IPAddress.Any, te.port);
      _listenerThread = null;

      StartListening (null);
    }
Exemple #2
0
        void Init(IServerChannelSinkProvider provider)
        {
            if (!_e.Incoming)
            {
                throw new InvalidOperationException("Non-listening Endpoint passed to IceServerChannel");
            }

            if (!(_e is TcpEndpoint))
            {
                throw new NotSupportedException("Only TcpEndpoints are supported as servers (for now)");
            }

            if (provider == null)
            {
                provider = new IceServerFormatterSinkProvider();
            }

            IServerChannelSink nextSink = ChannelServices.CreateServerChannelSinkChain(provider, this);

            TcpEndpoint te = _e as TcpEndpoint;

            string[] uris = null;
            if (te.port != 0)
            {
                uris    = new string[1];
                uris[0] = "ice://" + te.host + ":" + te.port;
            }

            _channelData = new ChannelDataStore(uris);
            _channelData["__iceEndpoint"] = _e;

            _sink = new IceServerTransportSink(nextSink);
            //      _listener = new TcpListener (te.IPAddress, te.port);
            _listener       = new TcpListener(IPAddress.Any, te.port);
            _listenerThread = null;

            StartListening(null);
        }