我通过使用python -m SimpleHTTPServer
调用服务器,将文件夹中的文件共享给其他设备。
我只是尝试将视频/音频(标准mp4和mp3,均低于20MB)流式传输到另一台计算机上。它工作(但通过在终端中抛出错误(列出))。
不知何故,视频/音频失败(除了非常小的mp3文件)与iPhone / iPad中的Safari一起玩。它绝对与媒体文件无关,因为我在iPhone中使用Apache成功传输它们。
知道为什么会这样吗?
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
答案 0 :(得分:6)
建议使用python alternative,What is a faster alternative to Python's http.server (or SimpleHTTPServer)?或使用完整的网络服务器。快速谷歌建议Mac支持Nginx和Apache2。