Unet
1.0.0
UNET는 순수한 Java를 사용하여 개발 한 가벼운 고성능 UDP Net 프레임 워크로 이벤트 모델 드라이브를 기반으로하고 동기 비 블로킹 IO를 사용합니다.
Unet unet = Unet . spawn ( new UnetConfig (). bindPort ( 1234 ));
unet . pipeline (). addInboundHandler ( buffer -> {
// Do something...
// Pass to the next processor
UnetContext . doRead ( buffer );
}). addInboundHandler ( buffer -> {
// Do something...
}). addOutboundHandler ( buffer -> {
// Outbound handler chain
// Do something
UnetContext . doSend ( buffer );
});
// Async send messages
unet . fireSend (
ByteBuffer . wrap ( "hello" . getBytes ( StandardCharsets . UTF_8 )),
new InetSocketAddress ( "target address" , 1234 )
);
// Sync send messages
unet . fireSend (
ByteBuffer . wrap ( "hello" . getBytes ( StandardCharsets . UTF_8 )),
new InetSocketAddress ( "target address" , 1234 )
). sync ();
// sync call is synchronized, is equivalent to this
unet . pipeline (). doSend (
ByteBuffer . wrap ( "hello" . getBytes ( StandardCharsets . UTF_8 )),
new InetSocketAddress ( "target address" , 1234 )
);
// Broadcast
unet . fireBroadcast (
ByteBuffer . wrap ( "hello" . getBytes ( StandardCharsets . UTF_8 )),
1234
);요구 사항
명령
mvn clean package이제 대상 폴더에서 볼 수 있습니다.