public override bool Equals(object other) { TcpEndpoint te = other as TcpEndpoint; if (te != null && te.host == host && te.port == port) { return(true); } return(false); }
public virtual void WriteEndpoint(Endpoint e) { if (e is TcpEndpoint) { TcpEndpoint te = e as TcpEndpoint; Write((short)1); // Endpoint Type BeginEncapsulation(); Write(te.host); Write(te.port); Write(te.timeout); Write(te.compress); EndEncapsulation(); } else if (e is SslEndpoint) { SslEndpoint se = e as SslEndpoint; Write((short)2); // Endpoint Type BeginEncapsulation(); Write(se.host); Write(se.port); Write(se.timeout); Write(se.compress); EndEncapsulation(); } else if (e is UdpEndpoint) { UdpEndpoint ue = e as UdpEndpoint; Write((short)3); // Endpoint Type BeginEncapsulation(); Write(ue.host); Write(ue.port); Write(ue.protocolMajor); Write(ue.protocolMinor); Write(ue.encodingMajor); Write(ue.encodingMinor); Write(ue.compress); EndEncapsulation(); } }
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); }