Results 1 to 2 of 2
  1. #1
    santhosh_el is offline Member
    Join Date
    Feb 2009
    Posts
    50
    Rep Power
    0

    Default socket commuication taking 3 minutes to send 512x512 bmp image

    i want to convert an bmp image size of 512x512.bmp into byte[] so that I can send it over a Socket.my problem is sending over a socket is taking 3 minutes.i have used getInputStream and getOutputStream.

    Any help will be greatly appreciated.

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Are you sending a byte per packet? Or are you sending it in larger chunks?

    Edit: this is how i send data on one of my connections (not sure if it helps):

    Java Code:
    output = new DataOutputStream(socket.getOutputStream ());
    Java Code:
    ...
    byte[] len = new byte[]{ 0, (byte)(b.length >> 16 & 0xff), (byte)(b.length >> 8 & 0xff), (byte)(b.length & 0xff) };
    synchronized(output)
    {
       //send out data size
       output.writeByte(len[1]); //1 byte
       output.writeByte(len[2]); //1 byte
       output.writeByte(len[3]); //1 byte
       //send data
       output.write(b,0,b.length); // n bytes
    }...
    Last edited by mrmatt1111; 10-07-2009 at 06:08 PM.
    My Hobby Project: LegacyClone

Similar Threads

  1. Replies: 5
    Last Post: 11-01-2009, 06:16 PM
  2. How to send folder through a connected socket
    By Chris555 in forum Networking
    Replies: 0
    Last Post: 07-18-2009, 12:41 PM
  3. Server socket - send image to client
    By Hinty in forum Networking
    Replies: 2
    Last Post: 03-14-2009, 08:39 AM
  4. Send an array via Socket
    By lene in forum Networking
    Replies: 0
    Last Post: 04-23-2008, 05:29 PM
  5. send files through socket
    By bbq in forum Advanced Java
    Replies: 1
    Last Post: 06-05-2007, 03:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •