Python port forwarding -


I am developing a client-server game in Python and I want to know more about port forwarding.

For example, what I'm doing is going to my router (192.168.0.1) and allow me to request a request for my real IP address Local address is being redirected to 192.168. 0.X. This really works well but I am thinking that I can do it automatically by coding?

I think Skype works like a type of p2p and I can see in my router that Skype is automatically port sent to my PC address Can I do it in Python too?

Here are various solutions, but most are not trivial, and you have to read something, The fallback will be required.


The simplest if your router supports it, and it is configured to allow, and you know how to get low-level networking code or old fashioned SOAP web service code To write, you can ask the router to provide a port. If it reacts with success, then start using that port and you are basically doing it.


If you can run the server with a public address (very low bandwidth) for all your users then solve the problem.

Think about how a NAT customer talks - behind a public server. You request some IP and port, but the server is watching the IP of your router, not your (which is good, because your access is not accessible). When it answers, then your router should be aware of forwarding it - it only remembers that you are a back-nat client who has only sent one request to that server.

What will happen, instead of talking to a public server, do you talk to some other partner behind your different NAT? Well, your router does not know the difference; Until you get a response from the same place, you will get it, but how do you get a response, when your message is not going through your NAT? He does the same thing, of course. One of the messages can be lost, but will be found through the other one, and then you are both setting and you can communicate regularly, you will need to send maintenance regularly, so the router does not forget that you communicate But besides this, nothing really is not difficult.

The only problem is that you have a public IP address other colleagues, and the port for which he expects you to come from, and he needs to know about it also. This is the reason that you have a server Required - Working as an introduction between peers.

Whole pinning will work with most of the home network with UDD. It will not work with TCP from many domestic networks, or with many corporate networks with UDP or TCP (In addition, in the corporate network, you have many levels of NAT, which means that you need an Internet interconcerator instead of just one on the Internet, or symmetric NAT, which can not be televised.)


You can use services like ICE or Turn (or similar). It works only when there is an ICE, turn, etc. service to use-which is not usually for two companions on the NAT of different houses, unless you deploy your own server Make and create an introduction to help, and if you are going to do this, you can use hole punching. But in the corporate environment, this could be the best way to provide connectivity to P2P applications.


Finally, you can manually configure the port-forwarding user and enter the forwarded port number in your problem. This is not ideal, but you should always provide it as a fallback (possibly leaving only for apps for corporate deployment), because nothing is working for all your users.


I believe Skype uses all of these. If you enable UPnP, then your router tries to IGD. Or you can configure it to use a shutdown server or you can only enter a specific port that you have manually forwarded. If you do not do any of the above, then it tries to use UDP punching, which has an introduction that runs Skype.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -