All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.tests.bla3 Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.jgroups.tests;

import org.jgroups.util.Util;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;

/**
 * @author Bela Ban
 * @since x.y
 */
public class bla3 {
    protected Socket sock;


    protected void start() throws Exception {
        InetAddress dest=InetAddress.getLocalHost();
        SocketAddress bind_addr=new InetSocketAddress("127.0.0.1", 7900);

        // sock=new Socket(dest, 7900, null, 7900);
        sock=new Socket();
        sock.bind(bind_addr);
        sock.connect(new InetSocketAddress(dest, 7900));


        byte[] buf=new byte[16];
        int read=sock.getInputStream().read(buf);
        String s=new String(buf, 0, read);
        System.out.println("s = " + s);
        Util.close(sock);
    }

    public static void main(String[] args) throws Exception {
        bla3 b=new bla3();
        b.start();
    }



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy