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: 236

Filed under:
|

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:

  1. connects to server creating socket connection
  2. creates a file on socket and sends data
  3. waits for file from server

Server:

  1. waits for file from client

Complete interraction:

  1. client sends data to server
  2. server sends data to client

© Stack Overflow or respective owner

Related posts about python

Related posts about sockets