linux - How to use Java to listen to port 17, 'qotd'? -


the problem found little description port 17, known "quote of date" port. useless port, nothing display quote less 512 ascii characters. give me more information how listen port 17 in java? have established server client socket using port:6017.

here code:

public class dateserver {     public static void main(string[] args) {         try {             serversocket sock = new serversocket(6017);              // listen connections             while (true) {                 socket client = sock.accept();                 // have connection                  printwriter pout = new printwriter(client.getoutputstream(), true);                 // write date socket                 pout.println(); // know must happens here!!!                  // close socket , resume listening more connections                 client.close();             }         } catch (ioexception ioe) {             system.err.println(ioe);         }     } } 

the system runs in linux , code server end of program. working on client part, , try make server same thing port 17 have client receive "quote of day" server.

ports less 1024 privileged , require escalated permissions run. run program administrator of machine port set 17.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -