Package com.kenai.jaffl.byref

Examples of com.kenai.jaffl.byref.IntByReference


    }
    @JRubyMethod
    public IRubyObject path(ThreadContext context) {
        if(openFile.getPath() == null) {
            LibCSocket.sockaddr_un addr = LibCSocket.sockaddr_un.newInstance();
            IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
            if(INSTANCE.getsockname(fd, addr, len) < 0) {
                rb_sys_fail(context.getRuntime(), null);
            }
            openFile.setPath(unixpath(addr, len));
        }
View Full Code Here


        return addr(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject addr(ThreadContext context) {
        LibCSocket.sockaddr_un addr = LibCSocket.sockaddr_un.newInstance();
        IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
        if(INSTANCE.getsockname(fd, addr, len) < 0) {
            rb_sys_fail(context.getRuntime(), "getsockname(2)");
        }
        return unixaddr(context.getRuntime(), addr, len);
    }
View Full Code Here

        return peeraddr(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject peeraddr(ThreadContext context) {
        LibCSocket.sockaddr_un addr = LibCSocket.sockaddr_un.newInstance();
        IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
        if(INSTANCE.getpeername(fd, addr, len) < 0) {
            rb_sys_fail(context.getRuntime(), "getpeername(2)");
        }
        return unixaddr(context.getRuntime(), addr, len);
    }
View Full Code Here

    @JRubyMethod(name = "recvfrom", required = 1, optional = 1)
    public IRubyObject recvfrom(ThreadContext context, IRubyObject[] args) {
       
        LibCSocket.sockaddr_un buf = LibCSocket.sockaddr_un.newInstance();
        IntByReference alen = new IntByReference(LibCSocket.sockaddr_un.LENGTH);

        IRubyObject len, flg;

        int flags;
View Full Code Here

        return accept(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject accept(ThreadContext context) {
        LibCSocket.sockaddr_un from = LibCSocket.sockaddr_un.newInstance();
        int fd2 = INSTANCE.accept(fd, from, new IntByReference(LibCSocket.sockaddr_un.LENGTH));
        if(fd2 < 0) {
            rb_sys_fail(context.getRuntime(), null);
        }

        Ruby runtime = context.getRuntime();
View Full Code Here

        return accept_nonblock(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject accept_nonblock(ThreadContext context) {
        LibCSocket.sockaddr_un from = LibCSocket.sockaddr_un.newInstance();
        IntByReference fromlen = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
       
        int flags = INSTANCE.fcntl(fd, RubyUNIXSocket.F_GETFL ,0);
        INSTANCE.fcntl(fd, RubyUNIXSocket.F_SETFL, flags | RubyUNIXSocket.O_NONBLOCK);

        int fd2 = INSTANCE.accept(fd, from, new IntByReference(LibCSocket.sockaddr_un.LENGTH));
        if(fd2 < 0) {
            rb_sys_fail(context.getRuntime(), null);
        }

        Ruby runtime = context.getRuntime();
View Full Code Here

TOP

Related Classes of com.kenai.jaffl.byref.IntByReference

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.