Read what buffer? Where is the actual bitmap data that you are reading? Assuming the client is sending this as a binary stream from the original bitmap buffer there should be no work to do at the server end other than ensuring you capture the entire buffer.
ifstream is basically for a file and not for a binary data.
What does this have to do with your problem?
As I understand it you are trying to transfer a bitmap from one computer to another via a network socket. So it is just a matter of transferring the binary data without any changes to its structure, and displaying the bitmap on the target system.
either you need to have a protocol implementation in your Clien-Server communication or you have to make sure that you send all the buffer at one time. If you are choosing a protocol means you first send a message to the server that am going to send a image buffer with size/length X and at the server store this and use this value for the next receive command.
If you are going to use whole buffer at one time, just use that buffer as such to create re-create your image. having a protocol is the best choice. if you google you can find many protocols choose the simplest one that suits your requirement.
Jibesh V P
Last Visit: 31-Dec-99 19:00 Last Update: 27-Feb-15 15:06