+ 3

Is there a way to connect two python scripts running on different devices,?

I want to connect two similar python scripts, on different devices. It is only for sharing text data.

27th May 2019, 4:34 AM
NightSkyLeaf
NightSkyLeaf - avatar
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.
27th May 2019, 9:48 AM
ΛM!N
ΛM!N - avatar
+ 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.
27th May 2019, 5:48 AM
ΛM!N
ΛM!N - avatar
+ 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.
4th Jun 2019, 5:35 AM
ΛM!N
ΛM!N - avatar
+ 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.
27th May 2019, 9:16 AM
NightSkyLeaf
NightSkyLeaf - avatar
+ 1
Is it possible if the phones are far away like in different states or country or is there a different way
3rd Jun 2019, 9:19 PM
NightSkyLeaf
NightSkyLeaf - avatar
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).
27th May 2019, 9:28 AM
ΛM!N
ΛM!N - avatar