org.apache.mina.transport.socket.nio.NioDatagramAcceptor Java Examples
The following examples show how to use
org.apache.mina.transport.socket.nio.NioDatagramAcceptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TftpServer.java From tftp4j with Apache License 2.0 | 5 votes |
@Override public void start() throws IOException { acceptor = new NioDatagramAcceptor(); acceptor.setDefaultLocalAddress(new InetSocketAddress(getPort())); acceptor.getFilterChain().addLast("logger-data", new LoggingFilter("tftp-server-data")); acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TftpProtocolCodecFactory())); acceptor.getFilterChain().addLast("logger-packet", new LoggingFilter("tftp-server-packet")); acceptor.setHandler(new TftpServerProtocolHandler(getDataProvider())); DatagramSessionConfig dcfg = acceptor.getSessionConfig(); dcfg.setReuseAddress(true); // dcfg.setIdleTime(IdleStatus.BOTH_IDLE, 5); acceptor.bind(); }
Example #2
Source File: HelloUdpServer.java From mina-examples with MIT License | 5 votes |
public static void main(String[] args) throws Exception { NioDatagramAcceptor acceptor = new NioDatagramAcceptor();//UDP Acceptor acceptor.getFilterChain().addLast("logging", new LoggingFilter()); acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory())); acceptor.getFilterChain().addLast("mdc", new MdcInjectionFilter()); acceptor.setHandler(new HelloServerHandler()); acceptor.getSessionConfig().setReadBufferSize(2048); acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10); DatagramSessionConfig dcfg = acceptor.getSessionConfig(); dcfg.setReuseAddress(true); acceptor.bind(new InetSocketAddress(PORT)); }
Example #3
Source File: DhcpServer.java From dhcp4j with Apache License 2.0 | 5 votes |
@PostConstruct @Override public void start() throws IOException, InterruptedException { super.start(); NioDatagramAcceptor a = new NioDatagramAcceptor(); a.bind(new InetSocketAddress(port)); a.getFilterChain().addLast("dhcp-wire", logger_wire); a.getFilterChain().addLast("dhcp-codec", codec); a.getFilterChain().addLast("dhcp-packet", logger_packet); a.setHandler(new DhcpProtocolHandler(service, this)); this.acceptor = a; }
Example #4
Source File: DhcpServer.java From dhcp4j with Apache License 2.0 | 5 votes |
@PostConstruct @Override public void start() throws IOException, InterruptedException { super.start(); NioDatagramAcceptor a = new NioDatagramAcceptor(); a.bind(new InetSocketAddress(port)); a.getFilterChain().addLast("dhcp-wire", logger_wire); a.getFilterChain().addLast("dhcp-codec", codec); a.getFilterChain().addLast("dhcp-packet", logger_packet); a.setHandler(new DhcpProtocolHandler(service, this)); this.acceptor = a; }
Example #5
Source File: UdpServer.java From game-server with MIT License | 2 votes |
/** * <p>Constructor for UdpServer.</p> * * @param minaServerConfig a {@link com.jzy.game.engine.mina.config.MinaServerConfig} object. * @param ioHandler a {@link org.apache.mina.core.service.IoHandler} object. */ public UdpServer(MinaServerConfig minaServerConfig, IoHandler ioHandler) { this.minaServerConfig = minaServerConfig; this.ioHandler = ioHandler; acceptor = new NioDatagramAcceptor(); }