public KQueueServerSocketChannel(int fd) { // Must call this constructor to ensure this object's local address is configured correctly. // The local address can only be obtained from a Socket object. this(new BsdSocket(fd)); }
private boolean doConnect0(SocketAddress remote) throws Exception { boolean success = false; try { boolean connected = socket.connect(remote); if (!connected) { writeFilter(true); } success = true; return connected; } finally { if (!success) { doClose(); } } }
public static BsdSocket newSocketDgram() { return new BsdSocket(newSocketDgram0()); }
PeerCredentials getPeerCredentials() throws IOException { return getPeerCredentials(intValue()); }
public static BsdSocket newSocketDomain() { return new BsdSocket(newSocketDomain0()); }
private boolean doFinishConnect() throws Exception { if (socket.finishConnect()) { writeFilter(false); if (requestedRemoteAddress instanceof InetSocketAddress) { remote = computeRemoteAddr((InetSocketAddress) requestedRemoteAddress, socket.remoteAddress()); } requestedRemoteAddress = null; return true; } writeFilter(true); return false; } }
AcceptFilter getAcceptFilter() throws IOException { String[] result = getAcceptFilter(intValue()); return result == null ? PLATFORM_UNSUPPORTED : new AcceptFilter(result[0], result[1]); }
socket.bind(localAddress); if (connected) { remote = remoteSocketAddr == null ? remoteAddress : computeRemoteAddr(remoteSocketAddr, socket.remoteAddress()); local = socket.localAddress(); return connected;
@Override protected void doBind(SocketAddress local) throws Exception { if (local instanceof InetSocketAddress) { checkResolvable((InetSocketAddress) local); } socket.bind(local); this.local = socket.localAddress(); }
@Override public int getReceiveBufferSize() { try { return ((KQueueSocketChannel) channel).socket.getReceiveBufferSize(); } catch (IOException e) { throw new ChannelException(e); } }
public static BsdSocket newSocketStream() { return new BsdSocket(newSocketStream0()); }
/** * Returns the unix credentials (uid, gid, pid) of the peer * <a href=http://man7.org/linux/man-pages/man7/socket.7.html>SO_PEERCRED</a> */ @UnstableApi public PeerCredentials peerCredentials() throws IOException { return socket.getPeerCredentials(); }
public AcceptFilter getAcceptFilter() { try { return ((KQueueServerSocketChannel) channel).socket.getAcceptFilter(); } catch (IOException e) { throw new ChannelException(e); } }
@Override protected void doDisconnect() throws Exception { socket.disconnect(); connected = active = false; }
socket.close();
try { do { int acceptFd = socket.accept(acceptedAddress); if (acceptFd == -1) {
@Override protected void doBind(SocketAddress localAddress) throws Exception { socket.bind(localAddress); local = (DomainSocketAddress) localAddress; }
private boolean doFinishConnect() throws Exception { if (socket.finishConnect()) { writeFilter(false); if (requestedRemoteAddress instanceof InetSocketAddress) { remote = computeRemoteAddr((InetSocketAddress) requestedRemoteAddress, socket.remoteAddress()); } requestedRemoteAddress = null; return true; } writeFilter(true); return false; } }
AcceptFilter getAcceptFilter() throws IOException { String[] result = getAcceptFilter(intValue()); return result == null ? PLATFORM_UNSUPPORTED : new AcceptFilter(result[0], result[1]); }