Package <Unnamed>

These are simple, robust, thread-safe UDP and TCP servers suitable for many applications.

See:
          Description

Interface Summary
NioServer.Listener An interface for listening to events from a NioServer.
TcpServer.Listener An interface for listening to events from a TcpServer.
UdpServer.Listener An interface for listening to events from a UdpServer.
 

Class Summary
NioServer A robust class for establishing simultaneous TCP and UDP servers and manipulating their listening ports.
NioServer.Adapter A helper class that implements all methods of the NioServer.Listener interface with empty methods.
NioServer.Event An event representing activity by a NioServer.
TcpServer A robust class for establishing a TCP server and manipulating its listening port.
TcpServer.Event An event representing activity by a TcpServer.
UdpServer A robust class for establishing a UDP server and manipulating its listening port and optionally a multicast groups to join.
UdpServer.Event An event representing activity by a UdpServer.
 

Enum Summary
NioServer.State One of four possible states for the server to be in:
TcpServer.State One of four possible states for the server to be in:
UdpServer.State One of four possible states for the server to be in:
 

Package Description

These are simple, robust, thread-safe UDP and TCP servers suitable for many applications.

Package Specification

The TcpServer and UdpServer classes use the standard java.io classes with Streams and Datagrams and so forth. The NioServer class uses the java.nio classes and can handle TCP and UDP connections (and multiple ports) in a single server; it uses ByteBuffers.

Using These Servers in Your Projects

There's no need to (and you probably shouldn't) copy all of these source files to your projects or try to include them all in an attached jar file. You should copy whichever servers (TcpServer, UdpServer, and NioServer) to your project tree and give the file an appropriate package com.you.yourproject line at the top.

Licensing (Public Domain)

Since this is Public Domain, you don't need to worry about licensing, and you can simply copy the UdpServer.java or TcpServer.java files to your own package and use them as you like.

Home Page

This and other code is available at iHarder.net.

See Also:
UdpServer, TcpServer, NioServer