Package jnr.unixsocket

Examples of jnr.unixsocket.UnixSocketChannel


            this.channel = channel;
            this.selector = selector;
        }
        public final boolean rxready() {
            try {
                UnixSocketChannel client = channel.accept();
                client.configureBlocking(false);
                client.register(selector, SelectionKey.OP_READ, new ClientActor(client));
                return true;
            } catch (IOException ex) {
                return false;
            }
        }
View Full Code Here


public class UnixClient {
    public static void main(String[] args) throws IOException {
        java.io.File path = new java.io.File("/tmp/fubar.sock");
        String data = "blah blah";
        UnixSocketAddress address = new UnixSocketAddress(path);
        UnixSocketChannel channel = UnixSocketChannel.open(address);
        System.out.println("connected to " + channel.getRemoteSocketAddress());
        PrintWriter w = new PrintWriter(Channels.newOutputStream(channel));
        w.print(data);
        w.flush();

        InputStreamReader r = new InputStreamReader(Channels.newInputStream(channel));
View Full Code Here

                if (!ready) {
                    // we were woken up without being selected...poll for thread events and go back to sleep
                    context.pollThreadEvents();

                } else {
                    UnixSocketChannel socketChannel = asUnixServer().accept();

                    RubyUNIXSocket sock = (RubyUNIXSocket)(RuntimeHelpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate"));

                    sock.channel = socketChannel;
                    sock.fpath = "";
View Full Code Here

            try {
                selectable.configureBlocking(false);

                try {
                    UnixSocketChannel socketChannel = ((UnixServerSocketChannel) channel).accept();

                    RubyUNIXSocket sock = (RubyUNIXSocket)(RuntimeHelpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate"));

                    sock.channel = socketChannel;
                    sock.fpath = "";
View Full Code Here

                if (!fpathFile.exists()) {
                    throw runtime.newErrnoENOENTError("unix socket");
                }
               
                UnixSocketChannel channel = UnixSocketChannel.open();

                channel.connect(new UnixSocketAddress(fpathFile));

                this.channel = channel;

            }
View Full Code Here

                if (!fpathFile.exists()) {
                    throw runtime.newErrnoENOENTError("unix socket");
                }
               
                UnixSocketChannel channel = UnixSocketChannel.open();

                channel.connect(new UnixSocketAddress(fpathFile));

                init_sock(runtime, channel);

            }
View Full Code Here

                if (!ready) {
                    // we were woken up without being selected...poll for thread events and go back to sleep
                    context.pollThreadEvents();

                } else {
                    UnixSocketChannel socketChannel = asUnixServer().accept();

                    RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate"));

                    sock.init_sock(context.runtime, socketChannel, "");
View Full Code Here

            try {
                selectable.configureBlocking(false);

                try {
                    UnixSocketChannel socketChannel = ((UnixServerSocketChannel) selectable).accept();

                    RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate"));

                    sock.init_sock(context.runtime, socketChannel, "");
View Full Code Here

TOP

Related Classes of jnr.unixsocket.UnixSocketChannel

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.