Package com.example.common.transport
Interface TransportFactory
- All Known Implementing Classes:
TcpSocketTransportFactory
public interface TransportFactory
The TransportFactory interface defines methods for creating transport listeners and connections.
-
Method Summary
Modifier and TypeMethodDescriptioncreateConnection
(String ip, int port, String encoding) Create a transport connection to the specified IP address and port with the given encoding.createListener
(int port, int maxCountConnections, String encoding) Create a transport listener that listens on the specified port with the given maximum count of connections.
-
Method Details
-
createListener
TransportListener createListener(int port, int maxCountConnections, String encoding) throws IOException Create a transport listener that listens on the specified port with the given maximum count of connections.- Parameters:
port
- the port number to listen onmaxCountConnections
- the maximum number of connections allowedencoding
- the encoding used for communication- Returns:
- a TransportListener object
- Throws:
IOException
- if an error occurs during creation
-
createConnection
Create a transport connection to the specified IP address and port with the given encoding.- Parameters:
ip
- the IP address to connect toport
- the port number to connect toencoding
- the encoding used for communication- Returns:
- a TransportConnection object
- Throws:
IOException
- if an error occurs during creation
-