本文整理汇总了C#中IceInternal.ProtocolInstance类的典型用法代码示例。如果您正苦于以下问题:C# ProtocolInstance类的具体用法?C# ProtocolInstance怎么用?C# ProtocolInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolInstance类属于IceInternal命名空间,在下文中一共展示了ProtocolInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StreamSocket
public StreamSocket(ProtocolInstance instance, Socket fd)
{
_fd = fd;
_state = StateConnected;
_desc = IceInternal.Network.fdToString(_fd);
init(instance);
}
示例2: WSEndpoint
internal WSEndpoint(ProtocolInstance instance, EndpointI del, BasicStream s)
{
_instance = instance;
_delegate = (IPEndpointI)del;
_resource = s.readString();
}
示例3: TcpEndpointI
public TcpEndpointI(ProtocolInstance instance, string ho, int po, EndPoint sourceAddr, int ti, string conId,
bool co)
: base(instance, ho, po, sourceAddr, conId)
{
_timeout = ti;
_compress = co;
}
示例4: UdpEndpointI
public UdpEndpointI(ProtocolInstance instance, string ho, int po, EndPoint sourceAddr, string mcastInterface,
int mttl, bool conn, string conId, bool co)
: base(instance, ho, po, sourceAddr, conId)
{
_mcastInterface = mcastInterface;
_mcastTtl = mttl;
_connect = conn;
_compress = co;
}
示例5: IPEndpointI
public IPEndpointI(ProtocolInstance instance, string host, int port, EndPoint sourceAddr, string connectionId)
{
instance_ = instance;
host_ = host;
port_ = port;
sourceAddr_ = sourceAddr;
connectionId_ = connectionId;
_hashInitialized = false;
}
示例6: UdpTransceiver
//
// Only for use by UdpConnector.
//
internal UdpTransceiver(ProtocolInstance instance, EndPoint addr, EndPoint sourceAddr, string mcastInterface,
int mcastTtl)
{
_instance = instance;
_addr = addr;
_sourceAddr = sourceAddr;
_readEventArgs = new SocketAsyncEventArgs();
_readEventArgs.RemoteEndPoint = _addr;
_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_writeEventArgs = new SocketAsyncEventArgs();
_writeEventArgs.RemoteEndPoint = _addr;
_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ioCompleted);
_mcastInterface = mcastInterface;
_mcastTtl = mcastTtl;
_state = StateNeedConnect;
_incoming = false;
try
{
_fd = Network.createSocket(true, _addr.AddressFamily);
setBufSize(-1, -1);
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);
}
}
}
}
catch(Ice.LocalException)
{
_fd = null;
throw;
}
}
示例7: UdpEndpointI
public UdpEndpointI(ProtocolInstance instance, BasicStream s) :
base(instance, s)
{
if(s.getReadEncoding().Equals(Ice.Util.Encoding_1_0))
{
s.readByte();
s.readByte();
s.readByte();
s.readByte();
}
// Not transmitted.
//_connect = s.readBool();
_connect = false;
_compress = s.readBool();
}
示例8: StreamSocket
public StreamSocket(ProtocolInstance instance, Socket fd)
{
_instance = instance;
_fd = fd;
_state = StateConnected;
try
{
_desc = IceInternal.Network.fdToString(_fd);
}
catch(Exception)
{
Network.closeSocketNoThrow(_fd);
throw;
}
init();
}
示例9: TcpConnector
//
// Only for use by TcpEndpoint
//
internal TcpConnector(ProtocolInstance instance, EndPoint addr, NetworkProxy proxy, EndPoint sourceAddr,
int timeout, string connectionId)
{
_instance = instance;
_addr = addr;
_proxy = proxy;
_sourceAddr = sourceAddr;
_timeout = timeout;
_connectionId = connectionId;
_hashCode = 5381;
IceInternal.HashUtil.hashAdd(ref _hashCode, _addr);
if(_sourceAddr != null)
{
IceInternal.HashUtil.hashAdd(ref _hashCode, _sourceAddr);
}
IceInternal.HashUtil.hashAdd(ref _hashCode, _timeout);
IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId);
}
示例10: UdpConnector
//
// Only for use by UdpEndpointI
//
internal UdpConnector(ProtocolInstance instance, EndPoint addr, EndPoint sourceAddr, string mcastInterface,
int mcastTtl, string connectionId)
{
_instance = instance;
_addr = addr;
_sourceAddr = sourceAddr;
_mcastInterface = mcastInterface;
_mcastTtl = mcastTtl;
_connectionId = connectionId;
_hashCode = 5381;
IceInternal.HashUtil.hashAdd(ref _hashCode, _addr);
if(sourceAddr != null)
{
IceInternal.HashUtil.hashAdd(ref _hashCode, _sourceAddr);
}
IceInternal.HashUtil.hashAdd(ref _hashCode, _mcastInterface);
IceInternal.HashUtil.hashAdd(ref _hashCode, _mcastTtl);
IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId);
}
示例11: 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;
}
}
示例12: TcpTransceiver
//
// Only for use by TcpConnector, TcpAcceptor
//
internal TcpTransceiver(ProtocolInstance instance, StreamSocket stream)
{
_instance = instance;
_stream = stream;
}
示例13: WSAcceptor
internal WSAcceptor(WSEndpoint endpoint, ProtocolInstance instance, Acceptor del)
{
_endpoint = endpoint;
_instance = instance;
_delegate = del;
}
示例14: Instance
//.........这里部分代码省略.........
const int defaultMessageSizeMax = 1024;
int num =
_initData.properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
if(num < 1 || num > 0x7fffffff / 1024)
{
_messageSizeMax = 0x7fffffff;
}
else
{
_messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
}
}
if(_initData.properties.getProperty("Ice.BatchAutoFlushSize").Length == 0 &&
_initData.properties.getProperty("Ice.BatchAutoFlush").Length > 0)
{
if(_initData.properties.getPropertyAsInt("Ice.BatchAutoFlush") > 0)
{
_batchAutoFlushSize = _messageSizeMax;
}
}
else
{
int num = _initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlushSize", 1024); // 1MB
if(num < 1)
{
_batchAutoFlushSize = num;
}
else if(num > 0x7fffffff / 1024)
{
_batchAutoFlushSize = 0x7fffffff;
}
else
{
_batchAutoFlushSize = num * 1024; // Property is in kilobytes, _batchAutoFlushSize in bytes
}
}
_cacheMessageBuffers = _initData.properties.getPropertyAsIntWithDefault("Ice.CacheMessageBuffers", 2);
_implicitContext = Ice.ImplicitContextI.create(_initData.properties.getProperty("Ice.ImplicitContext"));
_routerManager = new RouterManager();
_locatorManager = new LocatorManager(_initData.properties);
_referenceFactory = new ReferenceFactory(this, communicator);
_proxyFactory = new ProxyFactory(this);
_requestHandlerFactory = new RequestHandlerFactory(this);
bool isIPv6Supported = Network.isIPv6Supported();
bool ipv4 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
bool ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", isIPv6Supported ? 1 : 0) > 0;
if(!ipv4 && !ipv6)
{
throw new Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled.");
}
else if(ipv4 && ipv6)
{
_protocolSupport = Network.EnableBoth;
}
else if(ipv4)
{
_protocolSupport = Network.EnableIPv4;
}
else
{
_protocolSupport = Network.EnableIPv6;
}
_preferIPv6 = _initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
_networkProxy = createNetworkProxy(_initData.properties, _protocolSupport);
_endpointFactoryManager = new EndpointFactoryManager(this);
ProtocolInstance tcpProtocolInstance = new ProtocolInstance(this, Ice.TCPEndpointType.value, "tcp");
EndpointFactory tcpEndpointFactory = new TcpEndpointFactory(tcpProtocolInstance);
_endpointFactoryManager.add(tcpEndpointFactory);
ProtocolInstance udpProtocolInstance =
new ProtocolInstance(this, Ice.UDPEndpointType.value, "udp");
EndpointFactory udpEndpointFactory = new UdpEndpointFactory(udpProtocolInstance);
_endpointFactoryManager.add(udpEndpointFactory);
ProtocolInstance wsProtocolInstance = new ProtocolInstance(this, Ice.WSEndpointType.value, "ws");
_endpointFactoryManager.add(new WSEndpointFactory(wsProtocolInstance,
tcpEndpointFactory.clone(wsProtocolInstance)));
#if !SILVERLIGHT
_pluginManager = new Ice.PluginManagerI(communicator);
#endif
_outgoingConnectionFactory = new OutgoingConnectionFactory(communicator, this);
_servantFactoryManager = new ObjectFactoryManager();
_objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
_retryQueue = new RetryQueue(this);
}
示例15: init
private void init(ProtocolInstance instance, Transceiver del)
{
_instance = instance;
_delegate = del;
_state = StateInitializeDelegate;
_parser = new HttpParser();
_readState = ReadStateOpcode;
_readBuffer = new Buffer(ByteBuffer.ByteOrder.BIG_ENDIAN); // Network byte order
_readBufferSize = 1024;
_readLastFrame = true;
_readOpCode = 0;
_readHeaderLength = 0;
_readPayloadLength = 0;
_writeState = WriteStateHeader;
_writeBuffer = new Buffer(ByteBuffer.ByteOrder.BIG_ENDIAN); // Network byte order
_writeBufferSize = 1024;
_readPending = false;
_finishRead = false;
_writePending = false;
_readMask = new byte[4];
_writeMask = new byte[4];
_key = "";
_pingPayload = new byte[0];
_rand = new Random();
}