Sending file over socket
Posted
by johannix
on Stack Overflow
See other posts from Stack Overflow
or by johannix
Published on 2010-05-26T16:45:37Z
Indexed on
2010/05/26
17:11 UTC
Read the original article
Hit count: 254
I'm have a problem sending data as a file from one end of a socket to the other. What's happening is that both the server and client are trying to read the file so the file never gets sent. I was wondering how to have the client block until the server's completed reading the file sent from the client.
I have this working with raw packets using send and recv, but figured this was a cleaner solution...
Client:
- connects to server creating socket connection
- creates a file on socket and sends data
- waits for file from server
Server:
- waits for file from client
Complete interraction:
- client sends data to server
- server sends data to client
© Stack Overflow or respective owner