@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())); }
@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())); }
@JRubyMethod public IRubyObject remote_address(ThreadContext context) { Ruby runtime = context.runtime; InetSocketAddress address = getInetRemoteSocket(); if (address != null) { SocketType socketType = SocketType.forChannel(getChannel()); return new Addrinfo(runtime, runtime.getClass("Addrinfo"), address, socketType.getSocketType(), socketType); } UnixSocketAddress unix = getUnixRemoteSocket(); if (unix != null) { return Addrinfo.unix(context, runtime.getClass("Addrinfo"), runtime.newString(unix.path())); } throw runtime.newErrnoENOTCONNError(); }
@JRubyMethod public IRubyObject remote_address(ThreadContext context) { Ruby runtime = context.runtime; InetSocketAddress address = getInetRemoteSocket(); if (address != null) { SocketType socketType = SocketType.forChannel(getChannel()); return new Addrinfo(runtime, runtime.getClass("Addrinfo"), address, socketType.getSocketType(), socketType); } UnixSocketAddress unix = getUnixRemoteSocket(); if (unix != null) { return Addrinfo.unix(context, runtime.getClass("Addrinfo"), runtime.newString(unix.path())); } throw runtime.newErrnoENOTCONNError(); }
return getSocketType().intValue();
return getSocketType().intValue();
return getSocketType().intValue();
return getSocketType().intValue();