本文整理汇总了C#中IceInternal.ProtocolInstance.properties方法的典型用法代码示例。如果您正苦于以下问题:C# ProtocolInstance.properties方法的具体用法?C# ProtocolInstance.properties怎么用?C# ProtocolInstance.properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IceInternal.ProtocolInstance
的用法示例。
在下文中一共展示了ProtocolInstance.properties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TcpAcceptor
internal TcpAcceptor(TcpEndpointI endpoint, ProtocolInstance instance, string host, int port)
{
_endpoint = endpoint;
_instance = instance;
_backlog = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
try
{
int protocol = _instance.protocolSupport();
_addr = (IPEndPoint)Network.getAddressForServer(host, port, protocol, _instance.preferIPv6());
_fd = Network.createServerSocket(false, _addr.AddressFamily, protocol);
Network.setBlock(_fd, false);
# if !COMPACT
Network.setTcpBufSize(_fd, _instance);
# 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);
}
}
catch(System.Exception)
{
_fd = null;
throw;
}
}
示例2: UdpTransceiver
//
// Only for use by UdpConnector.
//
internal UdpTransceiver(ProtocolInstance instance, EndPoint addr, EndPoint sourceAddr, string mcastInterface,
int mcastTtl)
{
_instance = instance;
_addr = addr;
_sourceAddr = sourceAddr;
#if ICE_SOCKET_ASYNC_API
_readEventArgs = new SocketAsyncEventArgs();
_readEventArgs.RemoteEndPoint = _addr;
_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_writeEventArgs = new SocketAsyncEventArgs();
_writeEventArgs.RemoteEndPoint = _addr;
_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
#if SILVERLIGHT
String policy = instance.properties().getProperty("Ice.ClientAccessPolicyProtocol");
if(policy.Equals("Http"))
{
_readEventArgs.SocketClientAccessPolicyProtocol = SocketClientAccessPolicyProtocol.Http;
_writeEventArgs.SocketClientAccessPolicyProtocol = SocketClientAccessPolicyProtocol.Http;
}
else if(!String.IsNullOrEmpty(policy))
{
_instance.logger().warning("Ignoring invalid Ice.ClientAccessPolicyProtocol value `" + policy + "'");
}
#endif
#endif
_mcastInterface = mcastInterface;
_mcastTtl = mcastTtl;
_state = StateNeedConnect;
_incoming = false;
try
{
_fd = Network.createSocket(true, _addr.AddressFamily);
setBufSize(-1, -1);
#if !SILVERLIGHT
Network.setBlock(_fd, false);
if(Network.isMulticast((IPEndPoint)_addr))
{
if(_mcastInterface.Length > 0)
{
Network.setMcastInterface(_fd, _mcastInterface, _addr.AddressFamily);
}
if(AssemblyUtil.osx_)
{
//
// On Windows, we delay the join for the mcast group after the connection
// establishment succeeds. This is necessary for older Windows versions
// where joining the group fails if the socket isn't bound. See ICE-5113.
//
Network.setMcastGroup(_fd, ((IPEndPoint)_addr).Address, _mcastInterface);
if(_mcastTtl != -1)
{
Network.setMcastTtl(_fd, _mcastTtl, _addr.AddressFamily);
}
}
}
#endif
}
catch(Ice.LocalException)
{
_fd = null;
throw;
}
}
示例3: init
private void init(ProtocolInstance instance)
{
#if !SILVERLIGHT
Network.setBlock(_fd, false);
#endif
Network.setTcpBufSize(_fd, instance.properties(), instance.logger());
#if ICE_SOCKET_ASYNC_API
_readEventArgs = new SocketAsyncEventArgs();
_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_writeEventArgs = new SocketAsyncEventArgs();
_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
# if SILVERLIGHT
String policy = instance.properties().getProperty("Ice.ClientAccessPolicyProtocol");
if(policy.Equals("Http"))
{
_readEventArgs.SocketClientAccessPolicyProtocol = SocketClientAccessPolicyProtocol.Http;
_writeEventArgs.SocketClientAccessPolicyProtocol = SocketClientAccessPolicyProtocol.Http;
}
else if(!String.IsNullOrEmpty(policy))
{
instance.logger().warning("Ignoring invalid Ice.ClientAccessPolicyProtocol value `" + policy + "'");
}
# endif
#endif
//
// For timeouts to work properly, we need to receive/send
// the data in several chunks. Otherwise, we would only be
// notified when all the data is received/written. The
// connection timeout could easily be triggered when
// receiging/sending large messages.
//
_maxSendPacketSize = System.Math.Max(512, Network.getSendBufferSize(_fd));
_maxRecvPacketSize = System.Math.Max(512, Network.getRecvBufferSize(_fd));
}
示例4: UdpTransceiver
//
// Only for use by UdpEndpoint.
//
internal UdpTransceiver(UdpEndpointI endpoint, ProtocolInstance instance, string host, int port,
string mcastInterface, bool connect)
{
_endpoint = endpoint;
_instance = instance;
_state = connect ? StateNeedConnect : StateNotConnected;
_mcastInterface = mcastInterface;
_incoming = true;
_port = port;
try
{
_addr = Network.getAddressForServer(host, port, instance.protocolSupport(), instance.preferIPv6());
#if ICE_SOCKET_ASYNC_API
_readEventArgs = new SocketAsyncEventArgs();
_readEventArgs.RemoteEndPoint = _addr;
_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_writeEventArgs = new SocketAsyncEventArgs();
_writeEventArgs.RemoteEndPoint = _addr;
_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
#endif
_fd = Network.createServerSocket(true, _addr.AddressFamily, instance.protocolSupport());
setBufSize(instance.properties());
#if !SILVERLIGHT
Network.setBlock(_fd, false);
#endif
}
catch(Ice.LocalException)
{
#if ICE_SOCKET_ASYNC_API
if(_readEventArgs != null)
{
_readEventArgs.Dispose();
}
if(_writeEventArgs != null)
{
_writeEventArgs.Dispose();
}
#endif
_fd = null;
throw;
}
}