Thanks for your reply..
I am working client server app..
Chat is working properly even i am able transfer text file..
But facing problem with image..
Thanks for your reply..
I am working client server app..
Chat is working properly even i am able transfer text file..
But facing problem with image..
So if you want to write your own server that sends images to clients, you'll need to do the following:
For the server:
- Use QTcpServer and listen to a known TCP/IP port number greater than 1024
- Read the image filename sent by the client and verify it exists
- Open the image file, read the binary data and send to the client
- Close the connection to the client once the data is sent
For the client:
- Use QTcpSocket and connect to the server via ip addr or hostname and known port that server is listening to
- Send the image filename you want to receive to the server
- Read data from the socket and save to local file
- Close the file once the server closes the connection
Since TCP/IP is stream oriented, you will typically precede each request with some metadata about the data that follows so that you can determine when you have received a complete request. For example, I'd precede the actual image data with the length of the image file, so you can verify you receive the full image file, etc.
If you don't know how to get started, you have a challenge ahead of you. Google around for some Qt TCP/IP client/server examples and study the examples provided by Qt as well.
Good luck.
It can help you : http://hanckmann.com/2010/12/05/blog.html
Bookmarks