1

right now i am sending object like below.

Class msg{
  private byte[] byte;
  private String msg;
  public setbyte(byte[] b){byte=b;}
  public byte[] getbyte(){return byte;}

}

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

Socket mSocket;
msg mMsg=new msg();
mSocket = new Socket();
mSocket.bind(null);
mSocket.connect((new InetSocketAddress(mPeerIP, Constants.WELCOME_SOCKET_PORT)), 3000);
mOut = new ObjectOutputStream(mSocket.getOutputStream());
mOut.writeObject(mMsg);
mOut.flush();

Here mMsg is an object. But my socket get crash when i send heavy file above 50Mb. Is there any efficient way to send this object over socket.

Mukesh Gupta
  • 1,373
  • 3
  • 17
  • 42

0 Answers0