I'm extremely new to Java. I took the Fundamentals of the Java Programming Language Course a week ago at Sun's training center, and am now trying to apply some of it in preparation for the Cert exam.
One of the programs I'm trying to write is supposed to read a lot of information over IP, acting as a server. I've managed to create my socket, and create a BufferedReader that can read the data, however, the BufferedReader is filling up at 512 bytes of Data, and I can't figure out how to change it. According to what I've read, when I create the instance, I just need to specify a size, but that doesn't appear to be working. Any ideas?
This is the code I have. You'll see I tried to create it to be size 1024, but it still stops at 512. It doesn't seem to matter what size I put in. I've tried smaller sizes and bigger sizes, but it always fills up at 512 no matter what.
private static Socket s1;
private BufferedReader input;
public AMXClient()
{
try
{
s1=new Socket("10.198.9.1",1320);
input=new BufferedReader(new InputStreamReader(s1.getInputStream()),1024);
}
catch(ConnectException connExc)
{
System.out.println("Could not connect.");
}
}
I also tried changing the size of the InputStreamReader, thinking that if the inputstreamreader were too small, the bufferedreader's size wouldn't matter, but I get a compile error that says there's no constructor for InputStreamReader that involves an integer.
Thanks a bunch!