|
Post by rosy on Jan 15, 2021 9:46:32 GMT -6
I wanted to make it possible for my football game to play online. The easiest way to make computers communication on the Internet? Will the speed be enough for a dynamic game? If not, maybe at least it is possible to connect 2 phones in Android?
|
|
|
Post by n00b on Jan 15, 2021 11:38:22 GMT -6
Look at the network section in the Manual. There are examples of how to use TCP and UDP sockets in the examples folder.
You probably want to use UDP for your game.
|
|
|
Post by rosy on Feb 12, 2021 15:43:57 GMT -6
And what address should I enter there? I want to connect via the Internet, and if I have several computers connected to the router, they have the same IP address on the Internet.
|
|
|
Post by n00b on Feb 13, 2021 13:13:06 GMT -6
For the purpose of setting up network communication for your game you only need to worry about the IP address of the server so the other IP addresses don't really matter. In your case it would be the IP address of the router. Just make sure they are all communicating on the same port.
|
|
|
Post by rosy on Feb 13, 2021 15:08:46 GMT -6
I just don't understand why in your examples there is once port 0 and once 2000 ... And the router does not need to be reconfigured?
|
|
|
Post by n00b on Feb 13, 2021 16:17:36 GMT -6
I just don't understand why in your examples there is once port 0 and once 2000 ... And the router does not need to be reconfigured? I am sorry, I just looked at the UDP example and it is not a good example. I must have been in a rush when I wrote it. I have attached a far better example. I added more explanations to the code to make it easier to understand. Attachments:udp_server.bas (1.21 KB)
udp_client.bas (1.02 KB)
|
|
|
Post by rosy on Feb 14, 2021 6:58:43 GMT -6
For the client ... Instead of port = 0 it is better to Dim port, as it misleads There should be 8001 in the comment
Does he only receive from port 8001? What is the port variable for, if you know in advance what value it will take? What is this substitution for?
It doesn't work on the Internet anyway ...
|
|
|
Post by n00b on Feb 14, 2021 14:30:50 GMT -6
For the client ... Instead of port = 0 it is better to Dim port, as it misleads There should be 8001 in the comment Thanks for the feedback. I will make those improvements. Does he only receive from port 8001? What is the port variable for, if you know in advance what value it will take? What is this substitution for? When reading data the port variable is always going to be the port you opened your socket on. When sending it, it can be any port you choose, you just need to make sure that port is not being used by any other service on your OS. It doesn't work on the Internet anyway ... Make sure the IP Address you are transmitting on is publicly accessible and that its not blocking network traffic in your firewall. Also, there are occasions where the host data being transmitting by the remote PC is not the actual IP Address or URL for that PC. I would get around this by having my client transmit its IP Address when it first connects to the server.
|
|
|
Post by rosy on May 29, 2021 2:43:37 GMT -6
I have another problem with UDP. Data from computer A to B is going quite fast, and there is a distinct delay from B to A. What could it be ?
|
|