- Apr 10, 2006
- 12,028
- 2
- 0
I'm writing a program to find the date and from fields from our school's inbox in Java. I've done the project before in C++, but I'm having trouble reading the response from the server.
I just get the first line, then it eventually times out. It's not a server problem, because I can telnet it and go through the protocol just fine.
I just get the first line, then it eventually times out. It's not a server problem, because I can telnet it and go through the protocol just fine.
Socket s = new Socket(args[0], 143);
InputStream inStream= s.getInputStream();
OutputStream outStream = s.getOutputStream();
Scanner in = new Scanner(inStream);
PrintWriter out = new PrintWriter(outStream,true);
// Protocol - step #1 - read the initial greeting message from the server
while(in.hasNextLine()){response=in.nextLine(); System.out.println(response);}
