Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Send bitmap over socket

Anyone know how to send a bitmap handle over a socket? For context i'm trying to send a bitmap handle of a screenshot over a socket to be read by another computer to simulate a remote desktop.

Any advice appreciated!
You need to read the hanldle into a buffer then send the buffer across.
first what sockets do u use, indy , winsock ...etc .. TCP or UDP ? Do you want to send image from client or server socket ? give us more info

It is similar for any of them but it would be nice if u provide that info..

Usually logic is simple as this ( assuming that you know how to establish connection, take screenshot etc ):

bitmap->assign(ScreenCapture.. bla bla bla)
bitmap->savetostream(bitmapstream)
if u use indy for example u will do something like
aconntext->connection->socket->write(bitmapstream->size)
aconntext->connection->socket->write(bitmapstream)
Proud to be 100.000 user on HF

[Image: 4tAQ4Gf.png]
(Nov 1, 2019 02:49 AM)gua Wrote:  first what sockets do u use, indy , winsock ...etc .. TCP or UDP  ? Do you want to send image from client or server socket ? give us more info

It is similar for any of them but it would be nice if u provide that info..

Usually logic is simple as this ( assuming that you know how to establish connection, take screenshot etc ):

bitmap->assign(ScreenCapture.. bla bla bla)
bitmap->savetostream(bitmapstream)
if u use indy for example u will do something like
aconntext->connection->socket->write(bitmapstream->size)
aconntext->connection->socket->write(bitmapstream)

The questions you're asking do not matter at all whatsoever, and are a waste of time to answer; the process is the exact same, send x bytes from a buffer. If you're just going to spoonfeed him with his exact implementation that's your own prerogative, but I would advise against it. His misconception is asking how to send the handle.

@OP: Why would you send a bitmap handle over a socket connection? The handle is just a number that is completely useless to the far end, and it definitely isn't going to provide any bitmap data alone. You need to send the bytes of the actual bitmap itself... If you don't understand what handles are I can't see much success with creating remote desktop software.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(Nov 1, 2019 02:49 AM)gua Wrote:  first what sockets do u use, indy , winsock ...etc .. TCP or UDP  ? Do you want to send image from client or server socket ? give us more info

It is similar for any of them but it would be nice if u provide that info..

Usually logic is simple as this ( assuming that you know how to establish connection, take screenshot etc ):

bitmap->assign(ScreenCapture.. bla bla bla)
bitmap->savetostream(bitmapstream)
if u use indy for example u will do something like
aconntext->connection->socket->write(bitmapstream->size)
aconntext->connection->socket->write(bitmapstream)

I use winsock though TCP and I want to send the images from the server


(Nov 2, 2019 01:27 PM)0xDEAD10CC Wrote:  The questions you're asking do not matter at all whatsoever, and are a waste of time to answer; the process is the exact same, send x bytes from a buffer. If you're just going to spoonfeed him with his exact implementation that's your own prerogative, but I would advise against it. His misconception is asking how to send the handle.

@OP: Why would you send a bitmap handle over a socket connection? The handle is just a number that is completely useless to the far end, and it definitely isn't going to provide any bitmap data alone. You need to send the bytes of the actual bitmap itself... If you don't understand what handles are I can't see much success with creating remote desktop software.

Hi, I understand how a handle works, my main concern is what to do with the handle to send it across i.e. how do I convert it into bytes and then convert it back once sent across, "it" not meaning the handle but whatever I have to do with the handle to be able to send the bytes across.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SIM-3437924Nov 10, 2019 03:55 PM 11 344 Nov 10, 2019 03:55 PM
Last Post: YouthInAsia
[C] by SIM-3437924Oct 7, 2019 06:47 PM 0 122 Oct 7, 2019 06:47 PM
Last Post: SIM-3437924
[C#] by DNAJul 25, 2019 11:08 AM 0 133 Jul 25, 2019 11:08 AM
Last Post: DNA