Results 1 to 3 of 3

Thread: Fast Send

  1. #1

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Fast Send

    I need to send an image from one computer to another across an internet connection. Currently I am converting the image contents into DIbits, using copymemory to convert those into a byte array, sending the array via winsock, buffering the data, reloading it into a DIbits array, and presenting the final image. This takes roughly ten seconds of sending, and I'm still having trouble with conversions.
    I really need a fast way to send images, in the range of 1-3 seconds, ideally less than 1 second (although that's probably not possible). Is there any kind of method I could use? Thanks.

  2. #2
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Fast Send

    Well, you can't make it send faster, the speeds depends on your connection speed and the receiver's connection speed.

    But you can make the data shorter.
    (I did something like this in the past)

    You can convert to jpg and send the jpg data.
    OR, The way I did it:
    You send the first bitmap the way it is.
    Next screen shot you take, you compare the pixels of the previous bitmap, with the pixels of current bitmap, and see the diferences.
    At this point, there are several ways to make things shorter (in ters of data size)
    You can send only the lines, (vertical or horizontal) lines that have changed.
    Or analize the data, and find the "rectangle" within the bitmap that has changed, and send only that part of the picture.

    On top of that, I also used 2 compression methods.
    1) I used RLE (Run Length Encoding), look it up in google on what it is.
    2) After I compressed with RLE, I compressed with ZLib.DLL (See in CodeBank the thread I made about ZLib.DLL)

    All this also takes A LOT of CPU, so you have to find a balance between how much data to send, and how much CPU to take away.
    The more compressions methods you use, the longer it takes to compress and more CPU, but takes a short time to send, and the less compression you make, the longer it takes to send the data through the internet. It's a balance you have to find by yourself.

    Of course it is very complicated, to analize the data. But that is the only way I know how to do it.

  3. #3

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Re: Fast Send

    Is there a fast method for jpeg compression? Most of anything I search for comes up with saving jpegs, but I don't want to waste time messing with the hard drive, I'd like this all to be done as quickly as possible in memory.

Posting Permissions

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



Click Here to Expand Forum to Full Width