Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send picture over socket

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
Basically, I have the typical socket program, ServerSocket, ClientSocket... etc. The client needs to connect to the server, simple enough. I have all of that down by heart. But the whole reason the client connects is to recieve a .bmp or other picture file. That, I dont know how to do. Does anyone else?

In addition to that question, I have just one more. How does the ServerSocket recieve a stream? It can send one, as can the ClientSocket. But neither have the function to recieve it. Why send it if you can't recieve it?? Cyprus
[noevil]
 
The bmp is a file,you open it the normal way,and then send it to the client, like a text file. The client stores it,and
then you do your stuff with it.
Greetz,

The Muppeteer.

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Somehow I think that would be a bad idea requiring way too much work. The text of a bmp is so large that it's unreasonable to send the entire thing. A hundred things could go wrong with sending that much text. I need an FTP method, I think... or something telling me how to do Streams over sockets. Cyprus
[noevil]
 
Well,you want the bmp send over sockets do you ?
Doens't matter how big your bmp is, somehow you gonna have to send all the bytes over the network. You can do it all yourself,but I believe you can use ftp completely command line (with execvp or system or so...).
Another idea would be to create a seperate process that reads the bmp and sends it over sockets to the client, (which listens in a seperate process perhaps) and you don't really have to save it there ,like I last said, you can recieve it in a pipe and work further with that. I know it can ,but never done it myself.
You can also zip the bmp before sending it,if it is to large. bmps get really small after zipping.
Any useful ideas here for you ?

Greetz,

The Muppeteer.

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top