• Post Reply Bookmark Topic Watch Topic
  • New Topic

ObjectInputStream error. BIG error. BIG help required ;)  RSS feed

 
Kuku Rigu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys!

I saw there were couple of similar topics already but they didn' help me, so here's my problem:

I am writing a program that will interrogate a server. I haven't written the server (nor can I touch it to modify it, coz it's integrated in a commercial application), however it is installed on my machine (Win XP). I know the server is well written, because a guy before me wrote a C version of this program and worked without any problems whatsoever. Unfortunately, it has to be rewritten in Java.

Here's my code:


After numerous tests, change of ports (I can control the port on which the server is listening to), shifts of where the input stream is initialized, putting a 10 sec delay after ObjectOutputStream, etc, etc, I finally got my program to produce at least an error-

Before that nothing happend, it just deadlocked after
Now I am pretty much sure that ObjectInputStream [OIS] is to blame, however I do not know how to fix this problem. Even if OIS is called before OOS completes, how can I make it wait??? A 10 sec delay obviously doesn't do the trick :/ What's more, it runs smoothly and with no delay with C (well max delay=1 sec for timeout, but it is never reached).
So- PLEASE HELP!

Thanks!

[ May 14, 2004: Message edited by: Kuku Rigu ]

[ May 14, 2004: Message edited by: Kuku Rigu ]

[ May 14, 2004: Message edited by: Kuku Rigu ]
[ May 14, 2004: Message edited by: Kuku Rigu ]
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess would be that the other end of that socket isn't using an Object*putStream, especially since there is another client written in C. If you are expecting character data, use a BufferedReader. If you are expecting binary data, use a BufferedOutputStream.
 
Kuku Rigu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! It worked with:



Cheers again,

PsY
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!