public SocketListener() {}
// shutdown() stops the socket from accepting further connections
- abstract public void shutdown();
+ abstract public void shutdown() throws Exception;
// accept() returns a new Socket object if there is a connection
// attempt in progress AND if the connection passes the filter
this(listenaddr, port, false, null, true);
}
-// TcpListener::~TcpListener() {
-// if (closeFd) closesocket(fd);
-// }
+ protected void finalize() throws Exception {
+ if (closeFd)
+ try {
+ ((SocketDescriptor)getFd()).close();
+ } catch (IOException e) {
+ throw new Exception(e.getMessage());
+ }
+ }
- public void shutdown() {
- //shutdown(getFd(), 2);
+ public void shutdown() throws Exception {
+ try {
+ ((SocketDescriptor)getFd()).shutdown();
+ } catch (IOException e) {
+ throw new Exception(e.getMessage());
+ }
}
public TcpSocket accept() {