java - Limit between successive JVM bind calls to same port -
i have java code sets server on particular port, code run in python uses server, , port closed. i've set after each python run, java loops , repeats process (setting new server, serving, closing).
i notice when python call short (about <10s), next time java tries set port, fail. there rules how long must wait between successively setting same port on java?
ports can finicky type of thing. they're not meant opened , closed time. should leave socket open , handle each connection within, this:
serversocket listener = new serversocket(9090); try { while (true) { socket socket = listener.accept(); try { printwriter out = new printwriter(socket.getoutputstream(), true); out.println(new date().tostring()); } { socket.close(); } } } { listener.close(); }
Comments
Post a Comment