0

I know similar questions have been asked many times in many different forms before, but I couldn't find any that suited my needs.

I recently made a connect-four game in python, and I thought it would be cool to make it online, so two people on different networks can connect and play against each other.

Doing some research, I found that the easiest way is to enable port forwarding on my router. Unfortunately, that is not an option for me. I have also tried doing uPNP, but it didn't seem to work ("The Internet Gateway did not accept your changes" (Windows 10)).

So my question is this: Is there any way to access my Raspberry Pi or use it as a server without enabling port forwarding?

If someone knows how to solve the error above, I will also accept that as an answer.

4
  • 1
    use an MQTT broker to pass messages between the two devices ... here is a free one to get started on shiftr.io/try – jsotola Sep 29 '20 at 1:02
  • @jsotola not sure that would really suit my needs...could you explain in a little more detail what that would look like? – Thaddaeus Markle Sep 29 '20 at 1:42
  • 1
    basically the two devices would exchange data through the use of an MQTT broker ... one device would publish a message to a topic and the other device would receceive the message if it is subscribed to the topic ... shiftr.io/try has a graphical view of the broker interaction, so it is useful for development and for debugging ... you can see individual messages being published and also retrieved by various subscriptions ... the content of the messages is in the left margin ... examine the type of data that is being exchanged ... hopefully that gives you someplace to start – jsotola Sep 29 '20 at 2:23
  • You can play with MQTT from command line by installing mosquitto-clients package. – Dmitry Grigoryev Sep 29 '20 at 12:43
3

The solution could be:

  1. A service that resides on the internet.

  2. A service that resides behind a firewall where the firewall has ports exposed in to the service, aka "Port forwarding"

  3. uPNP. I will not cover this as because of security.

And since there is publicly available MQTT servers that could be used for your scenario its the most feasible solution.

A cloud service could also be an option.

2

I am not aware of any method of using sockets without port forwarding.

A socket is bound to a port. If that port is on an external machine by definition you need port forwarding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.