6 odpowiedzi
+ 1
When someone turns on his hotspot, his phone's ip is usually 192.168.43.1 for every body who is connected to his phone and you can run a server on 192.168.43.1 on any port you want with socket, so others devices can bind 192.168.43.1 server on that port and you can transfer data like text.
There's something like this in special forces group 2 game.
+ 2
Yes, you can use socket module.
Some time ago, I wanted to make a simple chat room using python and if you want to share text data, you almost have to do the same thing.
This web pages may help you:
https://www.tutorialspoint.com/simple-chat-room-using-python
https://www.geeksforgeeks.org/simple-chat-room-using-python/
I think there are other modules for doing what you want. I suggest you to google them.
+ 2
No, turning your hotspot on makes your phone like a modem, so just the ones who are close to you can connect you.
If the phones are going to have a lot of distance, you should use an online host as server.
I don't know if there's a simpler way, but if there is and you use it, you probably will struggle.
+ 1
I am creating a game which can be played individually or by two players competing with each other. And as far as I know socket programs need to be hosted on a website, which I am not capable of. So, I was hoping for something like wifi or bluetooth.
+ 1
Is it possible if the phones are far away like in different states or country or is there a different way
0
You can use hotspot. So one of the players can be others host if it's an android game. You have similar options for other devices, too(I think).