Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Audio/Video streaming fails using SimpleHTTPServer [closed]

I share files in a folder to other devices by invoking a server using python -m SimpleHTTPServer.

I just tried to stream videos/audio (standard mp4 & mp3, both under 20MB) to another computer using this & it WORKS (but by throwing the errors (listed down) in the terminal).

Somehow, the video/audio fails (except very small mp3 files) to play with Safari in iPhone/iPad. It is definitely not related to the media files, as I streamed them successfully using Apache in iPhone.

Any idea why it happens?

Exception happened during processing of request from ('192.168.1.2', 51775)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
like image 723
Jikku Jose Avatar asked Aug 03 '13 17:08

Jikku Jose


People also ask

What can I use instead of HTTP server?

Apache Tomcat, NGINX, JBoss, Jetty, and XAMPP are the most popular alternatives and competitors to Apache HTTP Server.

What is Python SimpleHTTPServer?

The SimpleHTTPServer module is a Python module that enables a developer to lay the foundation for developing a web server. However, as sysadmins, we can use the module to serve files from a directory. Usage. Python must be installed to use the SimpleHTTPServer module.

How do I close an HTTP server in Python?

To stop the server, I just press Ctrl+C.


1 Answers

As sugested either use python alternatives, What is a faster alternative to Python's http.server (or SimpleHTTPServer)? or use full blown web serwer altogether. Quick google suggests that Mac supports both Nignx and Apache2.

like image 99
jb. Avatar answered Sep 27 '22 22:09

jb.