public final UnixSocketAddress getRemoteSocketAddress() { if (state != State.CONNECTED) { return null; } return remoteAddress != null ? remoteAddress : (remoteAddress = getpeername(getFD())); }
public final UnixSocketAddress getLocalSocketAddress() { if (localAddress != null) { return localAddress; } else { localAddress = Common.getsockname(getFD()); return localAddress; } }
@Override public synchronized UnixSocketChannel bind(SocketAddress local) throws IOException { localAddress = bindHandler.bind(getFD(), local); return this; }
public final UnixSocketAddress getLocalSocketAddress() { if (state != State.CONNECTED) { return null; } return localAddress != null ? localAddress : (localAddress = getsockname(getFD())); }
@Override public <T> T getOption(SocketOption<T> name) throws IOException { if (!supportedOptions().contains(name)) { throw new UnsupportedOperationException("'" + name + "' not supported"); } return Common.getSocketOption(getFD(), name); }
@Override public <T> SocketChannel setOption(SocketOption<T> name, T value) throws IOException { if (name == null) { throw new IllegalArgumentException("name may not be null"); } if (!supportedOptions().contains(name)) { throw new UnsupportedOperationException("'" + name + "' not supported"); } Common.setSocketOption(getFD(), name, value); return this; }
public final UnixSocketAddress getRemoteSocketAddress() { if (!isConnected()) { return null; } if (remoteAddress != null) { return remoteAddress; } else { remoteAddress = Common.getpeername(getFD()); return remoteAddress; } }
ReflectiveAccess.FILE_DESCRIPTOR_FD.set(unixFD, ((UnixSocketChannel)channel).getFD()); return unixFD; } else if (channel instanceof UnixServerSocketChannel) {
ReflectiveAccess.FILE_DESCRIPTOR_FD.set(unixFD, ((UnixSocketChannel)channel).getFD()); return unixFD; } else if (channel instanceof UnixServerSocketChannel) {
FILE_DESCRIPTOR_FD.set(unixFD, ((UnixSocketChannel)channel).getFD()); return unixFD; } else if (channel instanceof UnixServerSocketChannel) {
FILE_DESCRIPTOR_FD.set(unixFD, ((UnixSocketChannel)channel).getFD()); return unixFD; } else if (channel instanceof UnixServerSocketChannel) {
@JRubyMethod public IRubyObject sysaccept(ThreadContext context) { RubyUNIXSocket socket = (RubyUNIXSocket) accept(context); return context.runtime.newFixnum(((UnixSocketChannel) socket.getChannel()).getFD()); }
@JRubyMethod public IRubyObject sysaccept(ThreadContext context) { RubyUNIXSocket socket = (RubyUNIXSocket) accept(context); return context.runtime.newFixnum(((UnixSocketChannel) socket.getChannel()).getFD()); }
private final boolean doConnect(SockAddrUnix remote) throws IOException { if (Native.connect(getFD(), remote, remote.length()) != 0) { Errno error = Errno.valueOf(LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime())); switch (error) { case EAGAIN: case EWOULDBLOCK: return false; default: throw new IOException(error.toString()); } } return true; }
private boolean doConnect(SockAddrUnix remote) throws IOException { if (Native.connect(getFD(), remote, remote.length()) != 0) { Errno error = Errno.valueOf(LastError.getLastError(jnr.ffi.Runtime .getSystemRuntime())); switch (error) { case EAGAIN: case EWOULDBLOCK: return false; default: throw new IOException(error.toString()); } } return true; }