Package java.net

Examples of java.net.SocketImpl


     * Determines the Unix file descriptor number of the given {@link ServerSocket}.
     */
    private int getUnixFileDescriptor(ServerSocket ss) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Field $impl = ss.getClass().getDeclaredField("impl");
        $impl.setAccessible(true);
        SocketImpl socketImpl = (SocketImpl)$impl.get(ss);
        Method $getFileDescriptor = SocketImpl.class.getDeclaredMethod("getFileDescriptor");
        $getFileDescriptor.setAccessible(true);
        FileDescriptor fd = (FileDescriptor) $getFileDescriptor.invoke(socketImpl);
        Field $fd = fd.getClass().getDeclaredField("fd");
        $fd.setAccessible(true);
View Full Code Here


        // now create a PlainSocketImpl
        Class $PlainSocketImpl = Class.forName("java.net.PlainSocketImpl");
        Constructor $init = $PlainSocketImpl.getDeclaredConstructor(FileDescriptor.class);
        $init.setAccessible(true);
        SocketImpl socketImpl = (SocketImpl)$init.newInstance(fd);

        // then wrap that into ServerSocket
        ServerSocket ss = new ServerSocket();
        ss.bind(new InetSocketAddress(0));
        Field $impl = ServerSocket.class.getDeclaredField("impl");
View Full Code Here

     *          If SDP is not supported
     * @throws  IOException
     *          If an I/O error occurs
     */
    public static Socket openSocket() throws IOException {
        SocketImpl impl = createSocketImpl();
        return new SdpSocket(impl);
    }
View Full Code Here

     * @throws  IOException
     *          If an I/O error occurs
     */
    public static ServerSocket openServerSocket() throws IOException {
        // create ServerSocket via package-private constructor
        SocketImpl impl = createSocketImpl();
        try {
            return serverSocketCtor.newInstance(impl);
        } catch (IllegalAccessException x) {
            throw new AssertionError(x);
        } catch (InstantiationException x) {
View Full Code Here

TOP

Related Classes of java.net.SocketImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.