java/utilities/src/main/java/com/pravala/socket/SocketUtils.java
public static FileDescriptor createLocalListeningSocket ( String socketPath )
    throws IOException, NoSuchFieldException, IllegalAccessException
    {
        int fd = createLocalListeningSocketFd ( socketPath );

        if ( fd < 0 )
        {
            throw new IOException ( "Cannot create local listening socket on file path: " + socketPath );
        }

        FileDescriptor fileDescriptor = new FileDescriptor();
        Field field = FileDescriptor.class.getDeclaredField ( "descriptor" );
        field.setAccessible ( true );
        field.setInt ( fileDescriptor, fd );
        return fileDescriptor;
    }
/**
     * Creates a local socket listening on the given socket file path.
     * This method always removes the socket path first before binding to the socket file path.
     * @param socketPath The socket file path to listen on
     * @return The new FileDescriptor on success, null on failure
     * @throws IOException if the socket cannot be created
     * @throws NoSuchFieldException if the FileDescriptor.descriptor field cannot be found
     * @throws IllegalAccessException if the FileDescriptor.descriptor field cannot be assigned
     */
Creates a local socket listening on the given socket file path.
This method always removes the socket path first before binding to the socket file path.
Creates a local socket listening on the given socket file path . This method always removes the socket path first before binding to the socket file path .
public static FileDescriptor createLocalListeningSocket ( String socketPath )
    throws IOException, NoSuchFieldException, IllegalAccessException
    {
        int fd = createLocalListeningSocketFd ( socketPath );
        if ( fd < 0 )
        {
            throw new IOException ( "Cannot create local listening socket on file path: " + socketPath );
        }
        FileDescriptor fileDescriptor = new FileDescriptor();
        Field field = FileDescriptor.class.getDeclaredField ( "descriptor" );
        field.setAccessible ( true );
        field.setInt ( fileDescriptor, fd );
        return fileDescriptor;
    }
public static FileDescriptor createLocalListeningSocket ( String socketPath ) throws IOException , NoSuchFieldException , IllegalAccessException { int fd = createLocalListeningSocketFd ( socketPath ) ; if ( fd < 0 ) { throw new IOException ( "Cannot create local listening socket on file path: " + socketPath ) ; } FileDescriptor fileDescriptor = new FileDescriptor ( ) ; Field field = FileDescriptor . class . getDeclaredField ( "descriptor" ) ; field . setAccessible ( true ) ; field . setInt ( fileDescriptor , fd ) ; return fileDescriptor ; }
Creates a local socket listening on the given socket file path.
Creates a local socket listening on the given socket file path .