Hello,
I am trying to create an IRC server. The thing is that I dont want this server to run on "localhost", I want to connect this server to other upstream IRC servers. I dont know how to do that. I.E. I want this server to connect to smth.hostname.com on port 9997 and get information from it. Please help!!!
public class Server {
public static void main(String[] arg) {
new Server(60656);
}
private ServerSocket serverSocket;
Server(int port) {
try
{
serverSocket = new ServerSocket(port);
System.out.println("Server waiting for client on port " + serverSocket.getLocalPort());
while(true)
{
Socket socket = serverSocket.accept();
System.out.println("New client asked for a connection");
TcpThread t = new TcpThread(socket); // make a thread of it
System.out.println("Starting a thread for a new Client");
t.start();
}
}
catch (IOException e) {
System.out.println("Exception on new ServerSocket: " + e);
}
}
}