All Projects → Shevchik → Udpserversocketchannel

Shevchik / Udpserversocketchannel

Licence: lgpl-3.0
Netty udp server socket channel which allocates separate channel per remote address

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Udpserversocketchannel

Kingim
KingIM是基于layim的websocket即时通讯系统,底层使用netty。
Stars: ✭ 538 (+2052%)
Mutual labels:  netty
Servicetalk
A networking framework that evolves with your application
Stars: ✭ 656 (+2524%)
Mutual labels:  netty
Unfiltered
A toolkit for servicing HTTP requests in Scala
Stars: ✭ 709 (+2736%)
Mutual labels:  netty
Sample Spring Microservices New
Demo for Spring Boot 2 and Spring Cloud microservices with distributed configuration (Spring Cloud Config), service discovery (Eureka), API gateway (Spring Cloud Gateway, Zuul), Swagger2 API documentation, logs correlation using Spring Cloud Sleuth and many more
Stars: ✭ 559 (+2136%)
Mutual labels:  netty
Jforgame
jforgame是一个一站式游戏服务器开发框架。包含游戏服,跨服,匹配服,后台管理系统等模块。同时提供大量业务案例以供学习。
Stars: ✭ 601 (+2304%)
Mutual labels:  netty
Ibooks
计算机图书,java,mysql,架构类,web
Stars: ✭ 666 (+2564%)
Mutual labels:  netty
Xxl Rpc
A high performance, distributed RPC framework.(分布式服务框架XXL-RPC)
Stars: ✭ 493 (+1872%)
Mutual labels:  netty
Game Server
Distributed Java game server, including cluster management server, gateway server, hall server, game logic server, background monitoring server and a running web version of fishing. State machine, behavior tree, A* pathfinding, navigation mesh and other AI tools
Stars: ✭ 916 (+3564%)
Mutual labels:  netty
Brpc Java
Java implementation for Baidu RPC, multi-protocol & high performance RPC.
Stars: ✭ 647 (+2488%)
Mutual labels:  netty
Jcsprout
👨‍🎓 Java Core Sprout : basic, concurrent, algorithm
Stars: ✭ 26,536 (+106044%)
Mutual labels:  netty
Java Study
java-study 是本人学习Java过程中记录的一些代码!从Java基础的数据类型、jdk1.8的Lambda、Stream和日期的使用、 IO流、数据集合、多线程使用、并发编程、23种设计模式示例代码、常用的工具类, 以及一些常用框架,netty、mina、springboot、kafka、storm、zookeeper、redis、elasticsearch、hbase、hive等等。
Stars: ✭ 571 (+2184%)
Mutual labels:  netty
Netty Socketio
Socket.IO server implemented on Java. Realtime java framework
Stars: ✭ 5,565 (+22160%)
Mutual labels:  netty
Async Http Client
Asynchronous Http and WebSocket Client library for Java
Stars: ✭ 5,876 (+23404%)
Mutual labels:  netty
Books Recommendation
程序员进阶书籍(视频),持续更新(Programmer Books)
Stars: ✭ 558 (+2132%)
Mutual labels:  netty
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+2920%)
Mutual labels:  netty
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+2028%)
Mutual labels:  netty
Protools
历经开发周期两年,并且应用过千万级别项目的工具箱
Stars: ✭ 663 (+2552%)
Mutual labels:  netty
Elasticsearch Readonlyrest Plugin
Free Elasticsearch security plugin and Kibana security plugin: super-easy Kibana multi-tenancy, Encryption, Authentication, Authorization, Auditing
Stars: ✭ 917 (+3568%)
Mutual labels:  netty
Zipkin Armeria Example
Example project that shows how to use armeria and zipkin together
Stars: ✭ 17 (-32%)
Mutual labels:  netty
Vertx Sql Client
High performance reactive SQL Client written in Java
Stars: ✭ 690 (+2660%)
Mutual labels:  netty

UdpServerSocketChannel:

UDP server for netty 4.1 which allocates user channel per remote address (just like netty TCP server)
By default allocated channels are never closed, so it's up to user to close channels upon read timeout or any other event

Can also use multiple threads for IO if running epoll capable system (via SO_REUSEPORT)

Jenkins:

http://build.true-games.org/view/ProtocolSupport/job/UdpServerSocketChannel/

License:

GNU LGPLv3

Usage example:


import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.ServerChannel;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.timeout.ReadTimeoutHandler;
import udpserversocketchannel.channel.UdpServerChannel;

public class ExampleUdpServer {

	public static void main(String[] args) {
		ServerBootstrap bootstrap = new ServerBootstrap()
		.group(new DefaultEventLoopGroup())
		.childHandler(new ChannelInitializer<Channel>() {
			@Override
			protected void initChannel(Channel channel) throws Exception {
				channel.pipeline()
				.addLast(new ReadTimeoutHandler(2))
				.addLast(new Echo());
			}
		});
		if (args.length > 0) {
			int ioThreads = Integer.parseInt(args[0]);
			bootstrap.channelFactory(new ChannelFactory<ServerChannel>() {
				@Override
				public ServerChannel newChannel() {
					return new UdpServerChannel(ioThreads);
				}
			});
		} else {
			bootstrap.channel(UdpServerChannel.class);
		}
		bootstrap.bind("0.0.0.0", 1122).syncUninterruptibly();
	}

	private static class Echo extends SimpleChannelInboundHandler<ByteBuf> {
		@Override
		public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) {
			ctx.channel().close();
		}
		@Override
		public void channelActive(ChannelHandlerContext ctx) throws Exception {
			super.channelActive(ctx);
			System.err.println("ACTIVE: "+ctx.channel().remoteAddress());
		}
		@Override
		public void channelInactive(ChannelHandlerContext ctx) throws Exception {
			super.channelInactive(ctx);
			System.err.println("INACTIVE: "+ctx.channel().remoteAddress());
		}
		@Override
		protected void channelRead0(ChannelHandlerContext ctx, ByteBuf bytebuf) throws Exception {
			System.err.print("DATA: "+bytebuf.toString(StandardCharsets.UTF_8));
			ctx.channel().writeAndFlush(Unpooled.copiedBuffer(bytebuf));
		}
	}

}```
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].