 <p>The following code would do what you literally ask (assuming <code>thesocket</code> is a connected stream socket):</p> <pre><code>with open('thefile.mp3', 'rb') as f: thesocket.sendall(f.read()) </code></pre> <p>but of course it's unlikely to be much use without some higher-level protocol to help the counterpart know how much data it's going to receive, what type of data, and so forth.</p>