Skip to content

Instantly share code, notes, and snippets.

@irineu
irineu / EchoClient.java
Created August 27, 2022 17:55 — forked from ochinchina/EchoClient.java
Async socket demo in java
package asyncsocket;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;
import java.util.concurrent.atomic.AtomicInteger;