R
R
rusyska550112021-06-10 17:03:31
Python
rusyska55011, 2021-06-10 17:03:31

How to open ports for your internet server?

How to open ports of white ip address? It turns out that I open the port only gray, tk. only I can connect to the server from the server itself.
I try to connect through a regular browser - there is an answer. I try to connect via Tor or I ask a friend to connect to me - there is no connection.

In the router settings, I opened port 2000
60c216d2acd9e093777186.jpeg

In the windows firewall, I also opened port for incoming connections 2000
60c21727f120e208594873.jpeg

Server code:

from flask import Flask, request, jsonify
app = Flask(__name__)

@app.route('/price', methods=['GET', 'POST'])
def price():
    if request.method == 'POST':
        price = request.form['price']
        if int(price) < 1000:
            return jsonify({'msg': 'Нищий'})
        else:
            # Сюда алгоритм
            return jsonify({'msg': 'Вот тебе компьюдахтех'})
    else:
        return {'msg': '!'}

if __name__ == '__main__':
    app.run(host='0.0.0.0')


The server works on this ip (previously, I first tried to open port 5000, deleted all settings, and set it to 2000, although the server runs at 5000 at startup, strange)
60c217a8552f7143810636.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drno, 2021-06-10
@rusyska55011

Well, for starters, if there is no error, then the server is running on port 5000. Are you connecting to port 2000 via LAN?
Next - turn off the Windows firewall and antivirus in general, check
Do you even have an external IP from the provider? Have you subscribed to this service?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question