Hi,
we have problem with restart (stop and immediate start) of embedded BaseX server. The root cause is that when you close server socket it remains in a timeout state for a period of time and restart fails, because it is not possible to bind to a socket in timeout state. Enabling SO_REUSEADDR prior to binding the socket using bind allows the socket to be bound even though a previous connection is in a timeout state.
Following fix in BaseXServer class should help (lines 94 and 95):
socket = new ServerSocket(); socket.setReuseAddress(true); SocketAddress endpoint = new InetSocketAddress(port); socket.bind(endpoint);
esocket = new ServerSocket(); esocket.setReuseAddress(true); endpoint = new InetSocketAddress(context.mprop.num(MainProp.EVENTPORT)); esocket.bind(endpoint);
regards, Igor Farinic