Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to increase the buffer size of the stream

 
chander shivdasani
Ranch Hand
Posts: 206
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am developing a secure chat-server, in which i have to send rsa keys across client and server. However, when i try to send a key, i only receive part of the key on the other side. I feel the problem is because of the small buffer size. My key is of 1024 bit long. It is a RSA public key.

After googling, i came across two functions in the socket class:

socket.setReceiveBufferSize() and socket.setSendBufferSize().

Even after setting the buffer size, i am getting the same result.

Where am i going wrong?

 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the small pieces of code you use to send and receive the key?
 
chander shivdasani
Ranch Hand
Posts: 206
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

That problem is solved. What went wrong was that i was using BufferedReader and PrintWriter to read and write to stream. I changed it to ObjectInputStream and ObjectOutputStream.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic