本文整理汇总了C#中IceInternal.Instance.protocolSupport方法的典型用法代码示例。如果您正苦于以下问题:C# Instance.protocolSupport方法的具体用法?C# Instance.protocolSupport怎么用?C# Instance.protocolSupport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IceInternal.Instance
的用法示例。
在下文中一共展示了Instance.protocolSupport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TcpAcceptor
internal TcpAcceptor(Instance instance, string host, int port)
{
instance_ = instance;
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
_backlog = instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
try
{
_addr = Network.getAddressForServer(host, port, instance_.protocolSupport());
_fd = Network.createSocket(false, _addr.AddressFamily);
Network.setBlock(_fd, false);
#if !COMPACT
Network.setTcpBufSize(_fd, instance_.initializationData().properties, _logger);
#endif
if(AssemblyUtil.platform_ != AssemblyUtil.Platform.Windows)
{
//
// Enable SO_REUSEADDR on Unix platforms to allow
// re-using the socket even if it's in the TIME_WAIT
// state. On Windows, this doesn't appear to be
// necessary and enabling SO_REUSEADDR would actually
// not be a good thing since it allows a second
// process to bind to an address even it's already
// bound by another process.
//
// TODO: using SO_EXCLUSIVEADDRUSE on Windows would
// probably be better but it's only supported by recent
// Windows versions (XP SP2, Windows Server 2003).
//
Network.setReuseAddress(_fd, true);
}
if(_traceLevels.network >= 2)
{
string s = "attempting to bind to tcp socket " + Network.addrToString(_addr);
_logger.trace(_traceLevels.networkCat, s);
}
_addr = Network.doBind(_fd, _addr);
}
catch(System.Exception)
{
_fd = null;
throw;
}
}
示例2: EndpointHostResolver
internal EndpointHostResolver(Instance instance)
{
_instance = instance;
_protocol = instance.protocolSupport();
_preferIPv6 = instance.preferIPv6();
_thread = new HelperThread(this);
updateObserver();
if(instance.initializationData().properties.getProperty("Ice.ThreadPriority").Length > 0)
{
ThreadPriority priority = IceInternal.Util.stringToThreadPriority(
instance.initializationData().properties.getProperty("Ice.ThreadPriority"));
_thread.Start(priority);
}
else
{
_thread.Start(ThreadPriority.Normal);
}
}
示例3: UdpTransceiver
//
// Only for use by UdpEndpoint.
//
internal UdpTransceiver(Instance instance, string host, int port, string mcastInterface, bool connect)
{
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
_stats = instance.initializationData().stats;
_state = connect ? StateNeedConnect : StateNotConnected;
_incoming = true;
try
{
_addr = Network.getAddressForServer(host, port, instance.protocolSupport());
_fd = Network.createSocket(true, _addr.AddressFamily);
setBufSize(instance);
Network.setBlock(_fd, false);
if(_traceLevels.network >= 2)
{
string s = "attempting to bind to udp socket " + Network.addrToString(_addr);
_logger.trace(_traceLevels.networkCat, s);
}
if(Network.isMulticast(_addr))
{
Network.setReuseAddress(_fd, true);
_mcastAddr = _addr;
if(AssemblyUtil.platform_ == AssemblyUtil.Platform.Windows)
{
//
// Windows does not allow binding to the mcast address itself
// so we bind to INADDR_ANY (0.0.0.0) instead. As a result,
// bi-directional connection won't work because the source
// address won't the multicast address and the client will
// therefore reject the datagram.
//
if(_addr.AddressFamily == AddressFamily.InterNetwork)
{
_addr = new IPEndPoint(IPAddress.Any, port);
}
else
{
_addr = new IPEndPoint(IPAddress.IPv6Any, port);
}
}
_addr = Network.doBind(_fd, _addr);
if(port == 0)
{
_mcastAddr.Port = _addr.Port;
}
Network.setMcastGroup(_fd, _mcastAddr.Address, mcastInterface);
}
else
{
if(AssemblyUtil.platform_ != AssemblyUtil.Platform.Windows)
{
//
// Enable SO_REUSEADDR on Unix platforms to allow
// re-using the socket even if it's in the TIME_WAIT
// state. On Windows, this doesn't appear to be
// necessary and enabling SO_REUSEADDR would actually
// not be a good thing since it allows a second
// process to bind to an address even it's already
// bound by another process.
//
// TODO: using SO_EXCLUSIVEADDRUSE on Windows would
// probably be better but it's only supported by recent
// Windows versions (XP SP2, Windows Server 2003).
//
Network.setReuseAddress(_fd, true);
}
_addr = Network.doBind(_fd, _addr);
}
if(_traceLevels.network >= 1)
{
StringBuilder s = new StringBuilder("starting to receive udp packets\n");
s.Append(ToString());
List<string> interfaces =
Network.getHostsForEndpointExpand(_addr.Address.ToString(), instance.protocolSupport(), true);
if(interfaces.Count != 0)
{
s.Append("\nlocal interfaces: ");
s.Append(String.Join(", ", interfaces.ToArray()));
}
_logger.trace(_traceLevels.networkCat, s.ToString());
}
}
catch(Ice.LocalException)
{
_fd = null;
throw;
}
}