wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes OutputStreamReader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "OutputStreamReader" Watch "OutputStreamReader" New topic
Author

OutputStreamReader

Desmond Connor
Greenhorn

Joined: Feb 14, 2004
Posts: 1
hello I was wondering if someone could help me I am new to the scene and I have to create a client, for some reason when I compile it does not like my OutputStreamReader I would be very grateful if someone could help me
this is my code:
import java.net.*; //net
import java.io.*; //io
public class client{
public static void main (String args[]) throws IOException{
Socket soc = new Socket ("localhost", 1010);
System.out.println ("requesting data");
BufferedReader bin = new BufferedReader (new InputStreamReader (System.out));
String portnum = bin.readLine();
int port = Integer.parseInt (portnum);
while (true) {
Socket conn = new Socket ("localhost",1010);
BufferedReader fromserver = new BufferedReader (new InputStreamReader (conn.getOutputStream()));
String Datatoserver = (" ");
DataOutputStream toserver = (new DataOutputStream (conn.getOutputStream()));
toserver.writeBytes (Datatoserver+"\n");

String data = fromserver.readLine();
System.out.println (" ");
}
}
}
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Possibly that's because there's no such thing as an OutputStreamReader. You can have an InputStreamReader, or a OutputStreamWriter. If you use an InputStreamReader, the thing it reads should be... well... an InputStream. Not an OutputStream.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OutputStreamReader
 
Similar Threads
Running a client/server apllication
Help me in this code!
Send a String to Server and server send it somewhere on network
JAVA SOCKET PROGRAMMING
port number