https://paste.ubuntu.com/p/wPwN84dwM5/
from flask import Flask, redirect, url_for, request, render_template
import settings
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
app = Flask(__name__)
host=socket.gethostbyname(socket.gethostname())
port=8080
s.bind((host,port))
def receivedata():
while True:
data, addr = s.recvfrom(1024)
print(data.decode())
print(addr)
@app.route("/", methods=['POST', 'GET'])
def home():
if request.method == 'POST':
return render_template('home.html')
else:
receivedata()
return render_template('home.html')
app.run(debug=True)Above the code If I call only receivedata function it works but when I try to work with flask and add flask code I take this error. I have no idea why. Error is " normally only one use is allowed for each socket address". How can I fix this error?
