So, jeg kom ikke meget længere.
Jeg prøver at connecte til en IRC server for at få lidt feedback, men når aldrig længere end auth af ident
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
- package frozenchat;
-
- import java.io.*;
- import java.net.*;
-
- public class FrozenComClient {
- public static void main(String[] args) throws IOException {
- Socket clientSocket = null;
- PrintWriter clientOut = null;
- BufferedReader clientIn = null;
- try {
-
- clientSocket = new Socket(InetAddress.getByName("irc.freenode.net"), 6667);
- clientOut = new PrintWriter(clientSocket.getOutputStream(), true);
- clientIn = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
- } catch(UnknownHostException e) {
- System.err.println("Couldn't find host: " + InetAddress.getByName("irc.mozilla.org"));
- System.exit(1);
- } catch(IOException e) {
- System.err.println("Couldn't get I/O rights to server: localhost");
- System.exit(1);
- }
-
- BufferedReader userIn = new BufferedReader(new InputStreamReader(System.in));
- String fromServer, fromUser;
- while((fromServer = clientIn.readLine()) != null) {
- System.out.println("Server: " + fromServer);
- if(fromServer.equals("Bye!"))
- break;
- if(fromServer.equals("Found your hostname, welcome back"))
- {
- clientOut.println("PASS NOPASS");
- clientOut.println("NICK SaebekassebilII");
- clientOut.println("USER Saebekassebil 8 * :Something);
- clientOut.println("JOIN #help");
- }
-
- /*fromUser = userIn.readLine();
- if(fromUser != null) {
- System.out.println("Client: " + fromUser);
- clientOut.println(fromUser);
- }*/
- }
-
- clientOut.close();
- clientIn.close();
- userIn.close();
- clientSocket.close();
- }
- }
Og før følgende output fra serveren:
Server: NOTICE AUTH :*** Looking up your hostname...
Server: NOTICE AUTH :*** Found your hostname, welcome back
Server: NOTICE AUTH :*** Checking ident
Server: NOTICE AUTH :*** No identd (auth) response
Server: ERROR :Closing Link: 127.0.0.1 (Connection Timed Out)
Indlæg senest redigeret d. 22.06.2010 12:43 af Bruger #11328