I want to stream a file (mp3) in python. I've written the server code (which doesn't work):
import socket
HOST = ''
PORT = 8888
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
s.bind((HOST, PORT))
print 'Socket bind complete'
s.listen(1)
print 'Socket now listening'
conn, addr = s.accept()
data = open("song.mp3", "rb")
data = data.read()
conn.sendall(data)
I haven't written a client for it, as I wanted to make it work with VLC, Chrome and other music players. When trying in VLC it gives me a "Connection reset by peer" error, whereas in Chrome it gives a "Broken pipe" error.
What I'm trying to do is make a basic replica of AirPlay, but I don't know what's wrong.