public static final UnixDatagramChannel[] pair() throws IOException { int[] sockets = { -1, -1 }; Native.socketpair(ProtocolFamily.PF_UNIX, Sock.SOCK_DGRAM, 0, sockets); return new UnixDatagramChannel[] { new UnixDatagramChannel(sockets[0], State.CONNECTED, true), new UnixDatagramChannel(sockets[1], State.CONNECTED, true) }; }
public static final UnixSocketChannel[] pair() throws IOException { int[] sockets = { -1, -1 }; Native.socketpair(ProtocolFamily.PF_UNIX, Sock.SOCK_STREAM, 0, sockets); return new UnixSocketChannel[] { new UnixSocketChannel(sockets[0], State.CONNECTED, true), new UnixSocketChannel(sockets[1], State.CONNECTED, true) }; }
public static final UnixSocketChannel[] pair() throws IOException { int[] sockets = { -1, -1 }; Native.socketpair(ProtocolFamily.PF_UNIX, Sock.SOCK_STREAM, 0, sockets); return new UnixSocketChannel[] { new UnixSocketChannel(sockets[0], SelectionKey.OP_READ | SelectionKey.OP_WRITE), new UnixSocketChannel(sockets[1], SelectionKey.OP_READ | SelectionKey.OP_WRITE) }; }