Solved

Client/Server through-put

Posted on 1997-04-02
2
214 Views
Last Modified: 2010-04-16
I currently use datainputstream and printstream for my
server and get two requests per second.
I have seen a program which uses bytes in a dataoutputstream(??) is that faster?

I set up the streams like so:

try {
dis = new DataInputStream( theSock.getInputStream());
ps = new PrintStream( theSock.getOutputStream());
} catch (Exception e);

And scan the client inputl lke this:
 
while (theSock !=null) {
String input = null;
try {
input = dis.readLine().trim();
if(input != null)
      parent.handleInput(input, this);        

} catch (Exception e);
}

Which raises another question.
In my client executions stops and waits for a
 'dis.readLine().trim(); does the above also?

0
Comment
Question by:sty
2 Comments
 

Author Comment

by:sty
ID: 1219377
I want to know the fastest way to get data going from clients to server and to clients- for awesome games of course.

0
 
LVL 2

Accepted Solution

by:
majkl earned 70 total points
ID: 1219378
Well. They aren't very fast because Java is interpet language. But I can asure you both are pretty same. I have worked with both and landed with PrintStream and DataInputStream
I have made one observation tool for computers and it send huge amount of data from Server to Clients and it works pretty quick.
I haven't do optimization, which would be good, but  runs fast.
So there is no need to worry about speed.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question