setBroadcast(channel, asBoolean(value)); break; setKeepAlive(channel, asBoolean(value)); break; setSoLinger(channel, value <= 0, value); break; setOOBInline(channel, asBoolean(value)); break; setReceiveBufferSize(channel, value); break; setReuseAddress(channel, asBoolean(value)); break; setSendBufferSize(channel, value); break; setSoTimeout(channel, value); break;
protected SocketAddress getSocketAddress() { Channel channel = getOpenChannel(); return SocketType.forChannel(channel).getLocalSocketAddress(channel); }
return getBroadcast(channel) ? 1 : 0; return getKeepAlive(channel) ? 1 : 0; return getSoLinger(channel); return getOOBInline(channel) ? 1 : 0; return getReceiveBufferSize(channel); return getReuseAddress(channel) ? 1 : 0; return getSendBufferSize(channel); return getSoTimeout(channel); return getSocketType().intValue();
protected InetSocketAddress getRemoteSocket() throws BadDescriptorException { Channel channel = getOpenChannel(); return (InetSocketAddress)SocketType.forChannel(channel).getRemoteSocketAddress(channel); }
SocketType socketType = SocketType.forChannel(channel); socketType.setSoLinger(channel, false, 0); } else { int num = asNumber(val); if(num == -1) { socketType.setSoLinger(channel, false, 0); } else { socketType.setSoLinger(channel, true, num); socketType.setSocketOption(channel, opt, asNumber(val)); int intOpt = (int)_opt.convertToInteger().getLongValue(); if (IPPROTO_TCP.intValue() == intLevel && TCP_NODELAY.intValue() == intOpt) { socketType.setTcpNoDelay(channel, asBoolean(val));
channel = fptr.channel(); try { SocketType.forChannel(channel).shutdownInput(channel); channel = fptr.channel(); try { SocketType.forChannel(channel).shutdownOutput(channel);
@JRubyMethod public IRubyObject local_address(ThreadContext context) { Ruby runtime = context.runtime; InetSocketAddress address = getInetSocketAddress(); if (address != null) { SocketType socketType = SocketType.forChannel(getChannel()); return new Addrinfo(runtime, runtime.getClass("Addrinfo"), address, socketType.getSocketType(), socketType); } UnixSocketAddress unix = getUnixSocketAddress(); return Addrinfo.unix(context, runtime.getClass("Addrinfo"), runtime.newString(unix.path())); }
value = SocketType.forChannel(channel).getSocketOption(channel, opt); return number(runtime, SocketType.forChannel(channel).getSocketOption(channel, opt));
@JRubyMethod(compat = CompatVersion.RUBY1_9) public IRubyObject remote_address(ThreadContext context) { try { InetSocketAddress address = getRemoteSocket(); if (address == null) { return context.nil; } else { return new Addrinfo(context.runtime, context.runtime.getClass("Addrinfo"), address.getAddress(), address.getPort(), SocketType.forChannel(getChannel())); } } catch (BadDescriptorException bde) { throw context.runtime.newErrnoEBADFError("address unavailable"); } }
SocketType socketType = SocketType.forChannel(channel); socketType.setSoLinger(channel, false, 0); } else { int num = asNumber(val); if(num == -1) { socketType.setSoLinger(channel, false, 0); } else { socketType.setSoLinger(channel, true, num); socketType.setSocketOption(channel, opt, asNumber(val)); int intOpt = (int)_opt.convertToInteger().getLongValue(); if (IPPROTO_TCP.intValue() == intLevel && TCP_NODELAY.intValue() == intOpt) { socketType.setTcpNoDelay(channel, asBoolean(val));
channel = fptr.channel(); try { SocketType.forChannel(channel).shutdownInput(channel); channel = fptr.channel(); try { SocketType.forChannel(channel).shutdownOutput(channel);
protected InetSocketAddress getRemoteSocket() throws BadDescriptorException { Channel channel = getOpenChannel(); return (InetSocketAddress)SocketType.forChannel(channel).getRemoteSocketAddress(channel); }
@JRubyMethod public IRubyObject local_address(ThreadContext context) { Ruby runtime = context.runtime; InetSocketAddress address = getInetSocketAddress(); if (address != null) { SocketType socketType = SocketType.forChannel(getChannel()); return new Addrinfo(runtime, runtime.getClass("Addrinfo"), address, socketType.getSocketType(), socketType); } UnixSocketAddress unix = getUnixSocketAddress(); return Addrinfo.unix(context, runtime.getClass("Addrinfo"), runtime.newString(unix.path())); }
value = SocketType.forChannel(channel).getSocketOption(channel, opt); return number(runtime, SocketType.forChannel(channel).getSocketOption(channel, opt));
@JRubyMethod(compat = CompatVersion.RUBY1_9) public IRubyObject local_address(ThreadContext context) { try { InetSocketAddress address = getSocketAddress(); if (address == null) { return context.nil; } else { return new Addrinfo(context.runtime, context.runtime.getClass("Addrinfo"), address.getAddress(), address.getPort(), SocketType.forChannel(getChannel())); } } catch (BadDescriptorException bde) { throw context.runtime.newErrnoEBADFError("address unavailable"); } }
return getBroadcast(channel) ? 1 : 0; return getKeepAlive(channel) ? 1 : 0; int linger = getSoLinger(channel); return linger < 0 ? 0 : linger; return getOOBInline(channel) ? 1 : 0; return getReceiveBufferSize(channel); return getReuseAddress(channel) ? 1 : 0; return getSendBufferSize(channel); return getSoTimeout(channel); return getSocketType().intValue();
setBroadcast(channel, asBoolean(value)); break; setKeepAlive(channel, asBoolean(value)); break; setSoLinger(channel, value <= 0, value); break; setOOBInline(channel, asBoolean(value)); break; setReceiveBufferSize(channel, value); break; setReuseAddress(channel, asBoolean(value)); break; setSendBufferSize(channel, value); break; setSoTimeout(channel, value); break;
SocketType socketType = SocketType.forChannel(channel); if (val instanceof RubyString) { int[] linger = Option.unpackLinger(val.convertToString().getByteList()); socketType.setSoLinger(channel, linger[0] != 0, linger[1]); } else { throw runtime.newErrnoEINVALError("setsockopt(2)"); socketType.setSocketOption(channel, opt, asNumber(val)); int intOpt = (int)_opt.convertToInteger().getLongValue(); if (IPPROTO_TCP.intValue() == intLevel && TCP_NODELAY.intValue() == intOpt) { socketType.setTcpNoDelay(channel, asBoolean(val));
channel = getOpenChannel(); try { SocketType.forChannel(channel).shutdownInput(channel); channel = getOpenChannel(); try { SocketType.forChannel(channel).shutdownOutput(channel);
protected SocketAddress getSocketAddress() { Channel channel = getChannel(); return SocketType.forChannel(channel).getLocalSocketAddress(channel); }