Meaningless Drivel is fun!*
The moose likes I/O and Streams and the fly likes inputStream freezes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "inputStream freezes" Watch "inputStream freezes" New topic

inputStream freezes

Tomasz Lamek

Joined: Apr 27, 2010
Posts: 3
Hi. I have problem with my aplication. You must run it with argument 0(for server) and 1(for client).

I don't know why but it freezes on the ObjectInputStream constructors with Cipher streams. When I don't use
Cipher stream it works. When i have only ois = new ObjectInputStream(new CipherInputStream(s.getInputStream(), cipher2)); in the server and ous = new ObjectOutputStream(new CipherOutputStream(s.getOutputStream(), cipher2)); in the client it works too. What i'm doing wrong?
Thanks for your help and sorry for my english.
greetings for you all.
him jain
Ranch Hand

Joined: Feb 05, 2010
Posts: 56

I didn't get one thing in your code.You have used:
ObjectOutputStream ous = new ObjectOutputStream(s.getOutputStream());

and after that you have again allocated it with:
ous = new ObjectOutputStream(new CipherOutputStream(s.getOutputStream(), cipher));

So, I didn't get this part. when you have already obtained a stream ous, then wy are you not using this stream and re-intializing it.
This must not produce any result.
Anyways, what's the output you are getting?
I think error is with this stream only.
First have a socket -> then obtain a stream -> use it to read/write.
Hope it helped.

--Himanshu Jain
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: inputStream freezes
Similar Threads
encrypt and decrypt a file in Java
RSA encryption
Overhead IO : The cryptic case of the extra bytes
Digital Signature in PKCS 7 format with base 64 encoding
BadPaddingException using AES