Posted by tob1 Fri 23rd Feb 2007 16:11 - Syntax is Java 5 - 32 views
Download | New Post | Modify | Hide line numbers
  1. try {
  2.             Socket s = new Socket(getServername(), port);
  3.             BufferedReader sr = new BufferedReader(new InputStreamReader(s
  4.                     .getInputStream()));
  5.             BufferedWriter out = new BufferedWriter(new OutputStreamWriter(s
  6.                     .getOutputStream()));
  7.             s.setKeepAlive(true);
  8.             if (s.isConnected()) {
  9.                 out.write("/nick testnick");
  10.             }
  11.             String line;
  12.  
  13.  
  14.             while ((line = sr.readLine()) != null) {
  15.                 System.out.println(line);
  16.             }
  17.  
  18.             System.out.println("connected");
  19.         } catch ( e) {
  20.             e.printStackTrace();
  21.         } catch (IOException e) {
  22.             e.printStackTrace();
  23.         }

PermaLink to this entry https://pastebin.co.uk/10848
Posted by tob1 Fri 23rd Feb 2007 16:11 - Syntax is Java 5 - 32 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0