/** * Bind a new UDP server to the given bind address. By default the default server implementation is scanned * from the classpath on Class init. Support for Netty is provided as long as the relevant * library dependencies are on the classpath. * <p> * From the emitted {@link ReactorChannel}, one can decide to add in-channel consumers to read any incoming * data. * <p> * To reply data on the active connection, {@link ReactorChannel#writeWith} can subscribe to any passed {@link org.reactivestreams.Publisher}. * <p> * Note that {@link reactor.rx.Stream#getCapacity} will be used to switch on/off a channel in auto-read / flush on * write mode. * If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every * capacity batch size and read will pause when capacity number of elements have been dispatched. * <p> * Emitted channels will run on the same thread they have beem receiving IO events. * Apart from dispatching the write, it is possible to use {@link reactor.rx.Stream#dispatchOn} to process requests * asynchronously. * <p> * By default the type of emitted data or received data is {@link reactor.io.buffer.Buffer} * * @param bindAddress bind address (e.g. "127.0.0.1") to create the server on the passed port * @return a new Stream of ChannelStream, typically a peer of connections. */ public static DatagramServer<Buffer, Buffer> udpServer(String bindAddress) { return udpServer(bindAddress, DEFAULT_PORT); }
/** * Bind a new UDP server to the "loopback" address. By default the default server implementation is scanned * from the classpath on Class init. Support for Netty is provided as long as the relevant * library dependencies are on the classpath. * <p> * From the emitted {@link ReactorChannel}, one can decide to add in-channel consumers to read any incoming * data. * <p> * To reply data on the active connection, {@link ReactorChannel#writeWith} can subscribe to any passed {@link org.reactivestreams.Publisher}. * <p> * Note that {@link reactor.rx.Stream#getCapacity} will be used to switch on/off a channel in auto-read / flush on * write mode. * If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every * capacity batch size and read will pause when capacity number of elements have been dispatched. * <p> * Emitted channels will run on the same thread they have beem receiving IO events. * Apart from dispatching the write, it is possible to use {@link reactor.rx.Stream#dispatchOn} to process requests * asynchronously. * <p> * By default the type of emitted data or received data is {@link reactor.io.buffer.Buffer} * * @return a new Stream of ChannelStream, typically a peer of connections. */ public static DatagramServer<Buffer, Buffer> udpServer() { return udpServer(DEFAULT_BIND_ADDRESS); }
/** * Bind a new UDP server to the "loopback" address and specified port. By default the default server implementation * is scanned * from the classpath on Class init. Support for Netty is provided as long as the relevant * library dependencies are on the classpath. * <p> * From the emitted {@link ReactorChannel}, one can decide to add in-channel consumers to read any incoming * data. * <p> * To reply data on the active connection, {@link ReactorChannel#writeWith} can subscribe to any passed {@link org.reactivestreams.Publisher}. * <p> * Note that {@link reactor.rx.Stream#getCapacity} will be used to switch on/off a channel in auto-read / flush on * write mode. * If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every * capacity batch size and read will pause when capacity number of elements have been dispatched. * <p> * Emitted channels will run on the same thread they have beem receiving IO events. * Apart from dispatching the write, it is possible to use {@link reactor.rx.Stream#dispatchOn} to process requests * asynchronously. * <p> * By default the type of emitted data or received data is {@link reactor.io.buffer.Buffer} * * @param port the port to listen on the passed bind address * @return a new Stream of ChannelStream, typically a peer of connections. */ public static DatagramServer<Buffer, Buffer> udpServer(int port) { return udpServer(DEFAULT_BIND_ADDRESS, port); }
configuringFunction ) { return udpServer(DEFAULT_UDP_SERVER_TYPE, configuringFunction);
return udpServer(new Function<Spec.DatagramServerSpec<Buffer, Buffer>, Spec.DatagramServerSpec<Buffer, Buffer>>() { @Override public Spec.DatagramServerSpec<Buffer, Buffer> apply(Spec.DatagramServerSpec<Buffer, Buffer> serverSpec) {