Example #1
0
        setTcpBufSize(Socket socket, ProtocolInstance instance)
        {
            //
            // By default, on Windows we use a 128KB buffer size. On Unix
            // platforms, we use the system defaults.
            //
            int dfltBufSize = 0;

            if (AssemblyUtil.isWindows)
            {
                dfltBufSize = 128 * 1024;
            }
            int rcvSize = instance.communicator().GetPropertyAsInt("Ice.TCP.RcvSize") ?? dfltBufSize;
            int sndSize = instance.communicator().GetPropertyAsInt("Ice.TCP.SndSize") ?? dfltBufSize;

            setTcpBufSize(socket, rcvSize, sndSize, instance);
        }
Example #2
0
        internal TcpAcceptor(TcpEndpointI endpoint, ProtocolInstance instance, string host, int port)
        {
            _endpoint = endpoint;
            _instance = instance;
            _backlog  = instance.communicator().GetPropertyAsInt("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);
                Network.setTcpBufSize(_fd, _instance);
            }
            catch (Exception)
            {
                _fd = null;
                throw;
            }
        }