public class TCPServer extends Object
Modifier and Type | Method and Description |
---|---|
org.jboss.netty.channel.Channel |
getChannel() |
static org.jboss.netty.channel.ChannelFactory |
getChannelFactory(boolean nio) |
int |
getPort() |
void |
shutdown() |
static TCPServer |
start(int port) |
static TCPServer |
start(int port,
org.jboss.netty.channel.ChannelUpstreamHandler serverHandler)
Use nonSharableChannelPipeline which create a decoder for each connection
encoder is thread safe for netty
|
static TCPServer |
start(int port,
org.jboss.netty.channel.ChannelUpstreamHandler serverHandler,
org.jboss.netty.handler.codec.frame.FrameDecoder decoder,
org.jboss.netty.channel.ChannelDownstreamHandler encoder)
decoder must be thread safe, other wise data corruption
|
static TCPServer |
startOio(int port,
org.jboss.netty.channel.ChannelUpstreamHandler serverHandler) |
static TCPServer |
startOio(int port,
org.jboss.netty.channel.ChannelUpstreamHandler serverHandler,
org.jboss.netty.handler.codec.frame.FrameDecoder decoder,
org.jboss.netty.channel.ChannelDownstreamHandler encoder)
decoder must be thread safe, other wise data corruption
|
String |
toString() |
public int getPort()
public static TCPServer start(int port, org.jboss.netty.channel.ChannelUpstreamHandler serverHandler)
port
- serverHandler
- public static TCPServer start(int port, org.jboss.netty.channel.ChannelUpstreamHandler serverHandler, org.jboss.netty.handler.codec.frame.FrameDecoder decoder, org.jboss.netty.channel.ChannelDownstreamHandler encoder)
port
- serverHandler
- decoder
- encoder
- public static TCPServer startOio(int port, org.jboss.netty.channel.ChannelUpstreamHandler serverHandler, org.jboss.netty.handler.codec.frame.FrameDecoder decoder, org.jboss.netty.channel.ChannelDownstreamHandler encoder)
port
- serverHandler
- decoder
- encoder
- public static org.jboss.netty.channel.ChannelFactory getChannelFactory(boolean nio)
public static TCPServer startOio(int port, org.jboss.netty.channel.ChannelUpstreamHandler serverHandler)
public static TCPServer start(int port)
public org.jboss.netty.channel.Channel getChannel()
public void shutdown()
Copyright © 2016. All rights reserved.