How to get local IP of device in shiva3D?  [SOLVED]

How to get the best of multi player experience

How to get local IP of device in shiva3D?

Postby Bank8426 » 2013-01-14 22:15

I want to make my game work on LAN.Now it work well when play with each other.But the problem is i have to fix the IP of the host that client will connect.So i want to make the client can put the host IP in my game to connect.
But i don't know how to make it's show IP of device that play my game. :(
Bank8426
Expert Boarder
Expert Boarder
 
Posts: 91
Joined: 2011-10-20 20:21

Re: How to get local IP of device in shiva3D?

Postby DoctorPepper » 2013-01-14 23:01

Popular question. There was a tipic about it a while ago, they suggest using php on the server side, but im not sure if it can be done when both devices are on one router but offline.

http://www.shivaengine.com/developer/forum/viewtopic.php?f=21&t=21140
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Joined: 2011-05-10 22:19
Location: Belgium

Re: How to get local IP of device in shiva3D?

Postby Bank8426 » 2013-01-15 09:05

Thank you for suggestion.
But my game use connection like both devices are on one router but offline.
And i try to use searchForServer but nothing happen then i try to find device IP instead.
Is there another way to find IP by i don't to connect to php? :cry:
Bank8426
Expert Boarder
Expert Boarder
 
Posts: 91
Joined: 2011-10-20 20:21

Re: How to get local IP of device in shiva3D?  [SOLVED]

Postby DoctorPepper » 2013-01-16 19:17

Alright, so after banging my head against the wall for several hours, i realized that there is no real automatic solution.

You can try network.searchForServers ( nPort ) but that will take several minutes and may not even find anything.

You write a custom c++ plugin for each device (android, ios, pc, mac all need different code to get local ip). But for us, humble basic users, this would cost 800 bucks to upgrade to advanced vers of shiva. So that is out of the question.

You can ask the user to check network settings for each device and rewrite IP manually http://www.makeuseof.com/tag/find-ip-address-mobile-smartphone/
Its a nasty solution, but im sure not a problem for a group of friends, without internet connection in the same room, which is probably ur target audience.

setup php check with xml return, if by any chance their devices do have internet access.

The way i am implementing it right now, is by auto requesting ip from the server. if that fails, give an option to scan the network and type the adress manually, providing info on where to get it.

Not the most elegant solution, but at least better than nothing
DoctorPepper
Platinum Boarder
Platinum Boarder
 
Posts: 474
Joined: 2011-05-10 22:19
Location: Belgium

Re: How to get local IP of device in shiva3D?

Postby Bank8426 » 2013-01-17 19:38

Thank you for helping me find the solution.:P
I think i have to make user find their ip by themselve until get the better way.
:lol:
Bank8426
Expert Boarder
Expert Boarder
 
Posts: 91
Joined: 2011-10-20 20:21

Re: How to get local IP of device in shiva3D?

Postby pataya » 2013-05-21 17:25

here i change to autoip and it's take 5 min for found server pp

i also take this way for the next
pataya
Platinum Boarder
Platinum Boarder
 
Posts: 876
Joined: 2007-11-12 19:03

Re: How to get local IP of device in shiva3D?

Postby Fraser » 2013-10-13 16:24

Fraser,
User avatar
Fraser
Platinum Boarder
Platinum Boarder
 
Posts: 1324
Joined: 2012-02-05 19:28
Location: Europe

Re: How to get local IP of device in shiva3D?

Postby berdal84 » 2013-10-14 11:45

User avatar
berdal84
Platinum Boarder
Platinum Boarder
 
Posts: 701
Joined: 2007-11-07 00:37
Location: Montpellier - France

Re: How to get local IP of device in shiva3D?

Postby berdal84 » 2013-10-14 13:51

User avatar
berdal84
Platinum Boarder
Platinum Boarder
 
Posts: 701
Joined: 2007-11-07 00:37
Location: Montpellier - France

Re: How to get local IP of device in shiva3D?

Postby turowskipaul » 2013-11-27 02:37

If you can broadcast a UDP message to a listener then you can get the IP of the sender. I've been working on a plugin to do just this, but am having trouble building the plugin for Android. The post is here:



Once I get a working version I will post the results. I welcome any help with this project, suggestions, comments, etc.
turowskipaul
Senior Boarder
Senior Boarder
 
Posts: 57
Joined: 2013-11-14 19:35
Location: Virginia, USA


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest

cron