Solved

Which one is the best to be used?

Posted on 2004-10-12
12
158 Views
Last Modified: 2010-03-31
Hi All,
This is not homework.
I suppose that I have several choices to use and so I am questioning which one is to be used when dealing with sending Vectors


Given:
  Vector vec1;
  Vector vec2;

..............
DataOutputStream out= new DataOutputStream(socket.getOutputStream());
        while (true)
        {
             out.writeObject(vec1); // not sure which out.?? to use
             out.writeObject(vec2);
             out.flush();


................


Thanks in advance for your reply.

Delphi3
0
Comment
Question by:delphi3
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 16

Assisted Solution

by:krakatoa
krakatoa earned 20 total points
ID: 12295218
The ObjectOutputStream is one that I have used successfully and with relative ease.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 20 total points
ID: 12295309
Comes down to your application requirements, different transfer method have different pros and cons.
0
 
LVL 2

Accepted Solution

by:
ThummalaRaghuveer earned 20 total points
ID: 12299280
I think if an object is written into a stream then the program at the other end has to be in java.....

So If this is correct.... its better to send contents of the vector instead of sending an instance of vector....
0
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.

 
LVL 4

Author Comment

by:delphi3
ID: 12327944
Hi All,
Have to close this now. As written elsewhere  by a name unknown to me
  Roedy Green ©1996-2004 Canadian Mind Products writes:
"but this just reflects the chaos in Sun's design of java.io. It is a bit like doing jig-saw puzzles trying to find ways to fit the classes together. The asymmetry is astounding."

Sure I could download some more compatable java tools like  rmi

So much for the java.io stuff. Why did I even start this?

Delphi3
0
 
LVL 4

Author Comment

by:delphi3
ID: 12327949
Prep for a split
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 12330359
>> Q_21166185.html#12327949  ...

Java only looks like an "asymmetrical puzzle" to people who are too stupid to understand or try to understand it. You'd be hard pressed to find anything in Java's approach that can't be explained to you by one or other of the main experts here.
0
 
LVL 4

Author Comment

by:delphi3
ID: 12330570
Maybe I will try again to post  another Q on the same topic within the next  24 hours and then wait for their genius to shine.

I really did try so many different ways to send and receive the data. None were clean without a lot of post processing.

Please, don't pass out the "stupid" label when I am  really looking for an answer.

D3  
0
 
LVL 92

Expert Comment

by:objects
ID: 12330589
What are you passing the data to?
Is it another Java application?
0
 
LVL 4

Author Comment

by:delphi3
ID: 12331344
Hi Objects,
 I want to  send the information from a java server to a java client all on the same computer, using a constant port number. The data is the vectors.

D3
0
 
LVL 92

Expert Comment

by:objects
ID: 12335190
sounds like ObjectInputStrteam/ObjectOutputStream would be the easiest then.
0
 
LVL 4

Author Comment

by:delphi3
ID: 12335370
Objects,

Have kept at this and have anticipated your response.  I will make a new post when finished here.
Please look at it and help me with the updated problem.  Almost there, or at least  I think so.

Thanks
D3
0
 
LVL 4

Author Comment

by:delphi3
ID: 12336155
Objects,

Posted a new related Q.  

But after a while I deleted it  based on your reply here.

Maybe a new Q really a lot later.

Thanks


D3
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 40
hibernate jars 4 45
pagenation logic how it is working in my code 1 56
ejb entity bean example issue 2 17
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…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

830 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