Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IRC

 
Raja Islam
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i want to connect to irc using sockets but it is not workign my MIRC is working fine but there is some problem it output
:tiscali.uk.eu.dal.net NOTICE AUTH :*** Looking up your hostname...
:tiscali.uk.eu.dal.net NOTICE AUTH :*** Checking Ident
:tiscali.uk.eu.dal.net NOTICE AUTH :*** Found your hostname
ERROR :Closing Link: 0.0.0.0 (Ping timeout)
**************************************************
import java.io.*;
import java.net.*;
public class IRCConnection
{
private String host;
private int port;
public static void main(String[] args) throws UnknownHostException, IOException
{
new IRCConnection("212.74.101.21", 6662 );
}
public IRCConnection( String host, int port )
throws UnknownHostException, IOException
{
this.host = host;
this.port = port;
connect();
register();
}
private PrintStream out;
private void connect() throws UnknownHostException, IOException
{

Socket socket = new Socket(host,port);
out = new PrintStream( socket.getOutputStream() );
InputStream x=socket.getInputStream();
DataInputStream xy=new DataInputStream(x);
String line;
while((line=xy.readLine())!=null)
{
System.out.println(line);
}
xy.close();

}
private void register()
{
String nickname = "test";
String localhost = "localhost";
out.println( "USER" + " " + nickname + " " + localhost + " " + host + " " + nickname );
out.println( "NICK" + " " + nickname);
}

}
i think it is not problem of port cause MIRC is workign fine on same port.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic