dcsimg
Ouput to a terminal screen
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bob_Mathews
Posted On:   Thursday, August 15, 2002 10:21 AM

I am trying to write an application that uses the SNPP protocol. It works very similar to SMTP. I open up a connection to the server and get the successful response code. I then need to output a serious of commands to the terminal. I have tried to do this, but none of my commands go through so the server times out after about 15 seconds. this is how I am trying to do it: Socket sock = new Socket("myserver.com", 444); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream())); // Try to get the response code String response = in.readLine(); System.out.print   More>>


I am trying to write an application that uses the SNPP protocol. It works very similar to SMTP. I open up a connection to the server and get the successful response code. I then need to output a serious of commands to the terminal. I have tried to do this, but none of my commands go through so the server times out after about 15 seconds.

this is how I am trying to do it:

			
Socket sock = new Socket("myserver.com", 444);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));

// Try to get the response code
String response = in.readLine();
System.out.println(response);

out.write("PAGE 3077738867");
response = in.readLine();
System.out.println(response);

I have also tried using DataInput/Output Streams
If I telnet to the server, I get a terminal that I can type commands which is the same sort of situation here.

Please Help!!!!!    <<Less

Re: Ouput to a terminal screen

Posted By:   michael_dean  
Posted On:   Thursday, August 15, 2002 11:08 AM

Try flushing the output stream.



Socket sock = new Socket("myserver.com", 444);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));

// Try to get the response code
String response = in.readLine();
System.out.println(response);

out.write("PAGE 3077738867");
out.flush();
response = in.readLine();
System.out.println(response);
About | Sitemap | Contact