AirPlay messes up localhost

2019-03-22 17:12发布

问题:

Since the last OSX update (Yosemite), my localhost server is full of error messages from airplay (but I am not using it). Each times it's the same:

[31/Oct/2014 05:40:42] code 400, message Bad request version ('RTSP/1.0')
[31/Oct/2014 05:40:42] "GET /info?txtAirPlay&txtRAOP RTSP/1.0" 400 -

It's just annoying to have its server full of error messages so if anyone has a clue to fix that or to remove airplay, I would be very thankful :)

回答1:

I think I found the answer: On a cisco discovery forum they listed an nmap output that revealed the Yosemite discoveryd port ranges. Turns out the Apple is using port 5000:

PORT      STATE SERVICE    VERSION
3689/tcp  open  daap       Apple iTunes DAAP 11.0.1d1
5000/tcp  open  rtsp       Apple AirTunes rtspd 160.10 (Apple TV)
7000/tcp  open  http       Apple AirPlay httpd
7100/tcp  open  http       Apple AirPlay httpd
62078/tcp open  tcpwrapped
5353/udp  open  mdns       DNS-based service discovery

As you can imagine this is the default Flask port, just change your running port to anything other than 5000, and this problem should disappear. This Flask extension https://github.com/miguelgrinberg/Flask-Runner can make your life much easier than hard coding the port in the run command.



回答2:

Also, under Flask.run() is the port arg so you can specify which port you'd like to use, this does work for localhost.

Here is the source documentation.

Example:

from flask import Flask, Response

app = Flask(__name__)

@app.route('/')
def default():
    return Response(status=200)

if __name__ == '__main__':
    app.run(debug=True, port=12345)


回答3:

I ran into this same problem, but it turned out that I had an error in my code. I was attempting to connect to a Redis server with the wrong port number and somehow that Airplay error appeared.

I'm not sure if this fixes your problem but it may help someone else encountering the same issue as I had.