Code example for LocalSocket

Methods: connect, setReceiveBufferSize, setSendBufferSize

0
 
    // Called by setup, connects the local sockets 
    public void prepare() throws IllegalStateException, IOException 
    { 
        // Open receiver local socket 
        receiver = new LocalSocket();
        int buffersize = 500000;
        try 
        { 
            // open local server socket and connect with receiving socket 
            lss = new LocalServerSocket("librtp-" + id);
            receiver.connect(new LocalSocketAddress("librtp-" + id));
 
            // Set receiver buffer sizes 
            receiver.setReceiveBufferSize(buffersize);
            receiver.setSendBufferSize(buffersize);
 
            // Connect the server and receiver sockets 
            sender = lss.accept();
 
            // Set sender buffer