I am trying to send a wav file through a socket.
I get the error:
TypeError: must be string or buffer, not instance
waveFile = wave.open(WAVE_OUTPUT_FILENAME, 'rb')
wave doesn't give you general file I/O. It is used for getting media properties.
You could use just normal open/close, read/write.
import socket (HOST,PORT)=('localhost',19123) s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect((HOST,PORT)) with open('input', 'rb') as f: for l in f: s.sendall(l) s.close()
import socket (HOST,PORT) = ('localhost',19123) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)); s.listen(1); conn, addr = s.accept() with open('output','wb') as f: while True: l = conn.recv(1024) if not l: break f.write(l) s.close()