views:

447

answers:

3

How could you send a bitmap over winsock without saving it to a file then sending that? It would also be helpful if you knew how to convert the data after being recieved back into a bitmap.

+1  A: 

What programming language are you using?

Basically, you've got to store the bitmap data into some kind of byte buffer, then send the bytes over the wire, and read the bitmap back out of the byte buffer at the other end.

As such, there are four tasks:

  • Save bitmap to buffer
  • Write data across wire using a socket
  • Read data from wire using a socket
  • Load a bitmap from a buffer

Which tasks in particular are you not clear about?

Barry Kelly
A: 

How would I convert the bitmap though? The send function requires a const char* and I have the bitmap stored in a BITMAP. Also how would I convert back? Thanks for the help, I am new to c++.

I suggest you ask again with more specific questions, such as: "Using C++ on Windows, how do I save a bitmap to a char buffer?", etc. Include any frameworks you are using, like ATL, WTL, MFC, etc., or if you just want raw SDK calls. Just asking "send bitmap with winsock" is far too vague.
Barry Kelly
Ok, I will next time.
A: 

how u do the first point "save bitmap to buffer"

Y_Y