Best Way To Send Multiple Images Sequentually Over a Network Stream

bigfoot3d

Well-known member
Joined
Mar 11, 2007
Messages
56
Location
New Orleans, LA
Programming Experience
3-5
I am sending images from a client computer to a console computer. The client computer sends the image to a server, and then the server turns around and forwards it to the console.

In 1280 x 1024, the jpeg image size is 126kb. Currently my server only does 158kbs down (0.94 seconds) and 70kbs (2.13 seconds) up, which is typical going through a home cable internet connection.

Is there anyway to compress or reduce the size of the image without reducing the resolution. I didn't know if the best thing was to compress on the client side through a memory stream before sending it to the network stream and then uncompressing on the console side after recieving the network stream using a memory stream. Or should i just compress to the network stream on the client side and uncompress from the network stream on the console side . Anything lower than 1280 x 1024 is not easily readable on the console side.

I know some would say just up the speed of the connection to the server, but my problem is am also trying to factor in the speed of connecting to homeusers computers as well, so i can't really eliminate the speed factor. I know there is someway to do this because in order to make remote desktop work properly and smoothly some kind of compression must be going on in order to smoothly transmit the remote desktop connection to my server from the internet.

Any insight on this would be greatly appreciated!

Thanks,
Craig:confused:
 
The (width, height) constructor of Bitmap creates a 32bpp PixelFormat image by default, this is what you typically use when taking a screenshot. If saving such bitmap to a different image encoding you have to use a 32bpp format like Png.

Processing 32bits images is only limited by the OS platform, which since Windows 95 have been operating in 32bit mode. Even if a very old graphics card has fewer bits and thus will limit the display capabilities this does not affect application processing of higher resolution images in all OS supported by .Net. You can see this in effect by saving a high-res image to a low-res format, you can still view the image, but it will loose much detail and look blocky.

The reason you're getting memory access violation with ReadInt32 is because you are not operating with a 32bpp image. The position is here calculated with 4 bytes per pixel, so if your image is 24bpp you will end up outside the memory area reserved by the image. Check the pos value when you're getting the exception and you'll see it is a high value, where for example the 24bpp image would be expected to end.
 
:rolleyes: Or one dumb dumb like me forgot to make the oldscreen the same size as the new screen. I was still setting the oldscreen to the screen parameters of the machine it was running on and not the size of the screen for which it was receiving its info from.

Wow what a difference. DOH! :eek:

Note to self. Oldscreen(width, height) Must Equal NewScreen(width, height)
 
Note to self. Oldscreen(width, height) Must Equal NewScreen(width, height)
I have noted that myself too, didn't even come to my mind that could be occuring. To emphasize; the images to compare must be identical size and pixelformat.
 
Sorry to resurrect an old thread, but I wanted to ask a question of bigfoot3d:
Would you please share the code you wrote to control the keyboard/mouse. Mainly what I'm hoping for are the primary functions used on the remote machine that lets you move the remote mouse, click and sending keypresses.

I know how to use SendKeys and SendWait, but I was wondering if maybe you used a different method for doing keypresses?

Also how do you deal with system keys like the start key? How do you prevent the local PC from showing it's start menu when it's pressed and sent to the remote machine?

As for the mouse, I haven't researched that yet... It's next on my list but I was really hoping bigfoot3d would be willing to volunteer some speed-me-up with already-working code ;) or throw in some pointers.

If not, I understand.

Thanks!
 
Well, don't need his help anymore. I ended up writing a couple of low-level hooks in a dll using C++ and the windows API. I can fully control the mouse and keyboard now and of course can call the functions from the dll in my VB app :)
 
Back
Top