Class ListeningHandleImpl
- java.lang.Object
-
- sk.ipesoft.d2000.d2japi.connector.ListeningHandleImpl
-
- All Implemented Interfaces:
ListeningHandle
public class ListeningHandleImpl extends java.lang.Object implements ListeningHandle
Implementation of listening handle.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close listening socket.java.net.InetAddress
getHost()
Get address of listening socket.int
getPort()
Get port number of listening socket.static ListeningHandle
startListening(java.lang.String hostname, int port, java.lang.String certificatePath, ServerSocketEventsListener serverListener)
Create new instance of listening handle that listens for incoming connections on designated port using TLS.static ListeningHandle
startListening(java.lang.String hostname, int port, ServerSocketEventsListener serverListener)
Create new instance of listening handle that listens for incoming connections on designated port.
-
-
-
Method Detail
-
startListening
public static ListeningHandle startListening(java.lang.String hostname, int port, ServerSocketEventsListener serverListener) throws ConnectorException
Create new instance of listening handle that listens for incoming connections on designated port.- Parameters:
hostname
- name of network interface, where to listen for connections ornull
for all interfacesport
- port numberserverListener
- listener that handles incoming requests- Returns:
- new instance of listening handle
- Throws:
ConnectorException
- when unable to connect
-
startListening
public static ListeningHandle startListening(java.lang.String hostname, int port, java.lang.String certificatePath, ServerSocketEventsListener serverListener) throws ConnectorException
Create new instance of listening handle that listens for incoming connections on designated port using TLS.- Parameters:
hostname
- name of network interface, where to listen for connections ornull
for all interfacesport
- port numbercertificatePath
- path to file with certificate used in TLSserverListener
- listener that handles incoming requests- Returns:
- new instance of listening handle
- Throws:
ConnectorException
- when unable to connect
-
close
public void close()
Description copied from interface:ListeningHandle
Close listening socket.- Specified by:
close
in interfaceListeningHandle
-
getHost
public java.net.InetAddress getHost()
Description copied from interface:ListeningHandle
Get address of listening socket.- Specified by:
getHost
in interfaceListeningHandle
- Returns:
- address of listening socket
-
getPort
public int getPort()
Description copied from interface:ListeningHandle
Get port number of listening socket.- Specified by:
getPort
in interfaceListeningHandle
- Returns:
- port number
-
-