Only thing that comes to mind, is that you might have two Internet connections on your Iphone (local wifi network, and some 3g from your carrier) and maybe it automatically selects 3g connection from your carrier and not a local wifi?
@ar2rsawseen How to get both ip address? Using method getIp in Unite.lua only get an IP address from 3G data, not wifi. I need the wifi IP address to connect with other device because I use wifi tethering to do multiplayer. When I turn off the 3G data, it return (0.0.0.0). Any idea?
Hello @riyann68 unfortunately it is a limitation of Lua Socket that you can not get list of all available device interfaces and their IP addresses. The hack used in GiderosUnite should return the current IP address of active interface, but since it is a hack, I feared that there might be situations where it won't work.
I actually tested GiderosUnite with Mobile Hotspots and it worked as expected (with multiple mobiles phones connected to same Mobile Hotspot communicating with each other), so I really can't imagine what the problem might be.
BTW @atilim how does Gideros Player retrieve interface's IP address for Gideros Studio to connect to?
@ar2sawseen: The problem is I can't get IP address of wifi interface when the device acts as the one that share/create wifi tethering. It always return the 3G data IP address.
When the device is connected to the router or the one that share/create wifi tethering, it's not a problem, method getIP in Unite.lua return the valid wifi interface IP address.
@SimplesApps well with LuaSockets you can create your own with any options you'd want. Unite framework was mostly tested in Local Area Networks and is working fine (at least I could not reproduce any problems), theoretically it could work with central server, but was not tested to do so.
“ The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ” - Tom Cargill
serverlink:startListening() seems to be missing from the end of your clientcode (i had to look a bit at your example project to find out that this is why it's not working for me). cool stuff btw.
@keszegh It works for me, what platform did it not work for you on?
(I use it for virtual joypad code - so that multiple players can play on the same screen)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
it does work after in the example Sample client code in the first post i added serverlink:startListening() at the end. (in drawtogether example it's also there)
@ar2rsawseen, what should i set if i want two copies of my app on the same computer to communicate with unite framework? (as this is a workaround for me to make 'multiple window' application for the time being) so there is only one server and one client. i guess maybe i have to change the ip of e.g. the client when doing new(config)? can i change it to anything? or what should i change it to? or some other way? thanks.
set which one to this, server or host or both or any one of them? and what if i don't know beforehand if the 2 apps are on the same pc or on different pc/phone/etc. on the network?
i tried setting the server like this, but it did not work: serverlink = Server.new({username = 'myServer',ip='127.0.0.1'})
hmm, I see, if you use 127.0.0.1 then all clients should be on the same machine too.
I don't know if it would work with external ip address, like get the ip address of device and connect multiple local apps to same ip and communicate between them. Unfortunately not sure if it would work.
if you could be more specific what should i try? i'm not that familiar with the details of the unite framework, also about net connections i don't know much in general. thanks a lot for your help.
Damn, of course it would not work, because Players are servers and you can't run two servers on same IP and port.
But from Gideros Unite point of view, it should work as long as one is server and other are clients. You could try to do the same with two desktop exported DrawTogether windows, or one exported, one player could also work
2xdrawtogether on same pc does not work for me, they don't see each other.
even if you can let me know a set up which works ONLY when both apps are on the same computer, that would be a great start, as in worst case the user will have to choose if he wants samepc-connection or regular connection.
i do what you suggested, in an exported drawtogether app they see each other this way, but when i start to draw i get the following error: /downloads/DrawTogether/assets/resource/classes/Unite.lua:295: Cannot assign requested address stack traceback: /downloads/DrawTogether/assets/resource/classes/Unite.lua:295: in function 'sendMsg' /downloads/DrawTogether/assets/resource/classes/Unite.lua:316: in function 'callMethod' /downloads/DrawTogether/assets/resource/draw.lua:130: in function
wow, it does work now! thanks. is there any chance that samepc client can also be discovered automatically? (by changing unite a bit or setting something something else) or do i definitely need to add different choice for user if he wants samepc or network connection? or perhaps i can try both at the same time and then if one of them succeeds then i cancel the other? this way the user does not need to care about chosing. is this possible with unite? i.e. to make more servers at the same time.
well, the only way to discover is to try to connect to local host address 127.0.0.1 if you can, then you discovered local server, if not there is no local server
If you can add it to discovery process, you could offer local server on same pc too in discovery dialog
if i want a server that listens to both samepc and network clients, then i need 2 servers i assume (one normal and one with 127.0.0.1)? (not that big deal as i wait only for 1 client, so after i got it i can close the unused server)
some further questions (only one for now, thanks for your patience): if i close a server then on the other clients a onServerClose event should fire; it does not seem to happen for me (same problem for client+onClientClose)
Comments
I actually tested GiderosUnite with Mobile Hotspots and it worked as expected (with multiple mobiles phones connected to same Mobile Hotspot communicating with each other), so I really can't imagine what the problem might be.
BTW @atilim how does Gideros Player retrieve interface's IP address for Gideros Studio to connect to?
When the device is connected to the router or the one that share/create wifi tethering, it's not a problem, method getIP in Unite.lua return the valid wifi interface IP address.
Is there some tricks to solve this?
Dislikes: unami
Could you (or anyone) check the scenarios with the connection problems?
At the end, it would be possible to create a multiplayer game between two anonymous end users ?
Is the Unite framework the best one we could use or is there another better?
Thanks.
https://play.google.com/store/apps/developer?id=SimplesApps
http://www.amazon.com/gp/mas/dl/android?p=com.simplesapps.actionbasket
https://itunes.apple.com/artist/david-rodriguez/id763996989
Unite framework was mostly tested in Local Area Networks and is working fine (at least I could not reproduce any problems), theoretically it could work with central server, but was not tested to do so.
update: It seems to work.. i downloaded this:
http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2
and pasted socket.lua in
Likes: Harrison
Always new things found here... although this have some time here.
Likes: ar2rsawseen
[-] Liasoft
cool stuff btw.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
(I use it for virtual joypad code - so that multiple players can play on the same screen)
https://deluxepixel.com
Fragmenter - animated loop machine and IKONOMIKON - the memory game
i guess maybe i have to change the ip of e.g. the client when doing new(config)? can i change it to anything? or what should i change it to? or some other way? thanks.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
and what if i don't know beforehand if the 2 apps are on the same pc or on different pc/phone/etc. on the network?
i tried setting the server like this, but it did not work:
serverlink = Server.new({username = 'myServer',ip='127.0.0.1'})
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I don't know if it would work with external ip address, like get the ip address of device and connect multiple local apps to same ip and communicate between them. Unfortunately not sure if it would work.
thanks a lot for your help.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
But I already forgot most of that now. It was always the part I did not want to get my hands dirty with
What if you use DrawTogether example and open two Gideros player windows and try to run them, one as server, other as client. Would it work?
But from Gideros Unite point of view, it should work as long as one is server and other are clients. You could try to do the same with two desktop exported DrawTogether windows, or one exported, one player could also work
even if you can let me know a set up which works ONLY when both apps are on the same computer, that would be a great start, as in worst case the user will have to choose if he wants samepc-connection or regular connection.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I think for that case you would need to set both server and clients to same IP address, you can try it with 127.0.0.1.
And force clients to connect to server without discovery, but directly using serverIP 127.0.0.1
/downloads/DrawTogether/assets/resource/classes/Unite.lua:295: Cannot assign requested address
stack traceback:
/downloads/DrawTogether/assets/resource/classes/Unite.lua:295: in function 'sendMsg'
/downloads/DrawTogether/assets/resource/classes/Unite.lua:316: in function 'callMethod'
/downloads/DrawTogether/assets/resource/draw.lua:130: in function
Fragmenter - animated loop machine and IKONOMIKON - the memory game
is there any chance that samepc client can also be discovered automatically? (by changing unite a bit or setting something something else)
or do i definitely need to add different choice for user if he wants samepc or network connection?
or perhaps i can try both at the same time and then if one of them succeeds then i cancel the other? this way the user does not need to care about chosing. is this possible with unite? i.e. to make more servers at the same time.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
if you can, then you discovered local server, if not there is no local server
If you can add it to discovery process, you could offer local server on same pc too in discovery dialog
Fragmenter - animated loop machine and IKONOMIKON - the memory game
if i close a server then on the other clients a onServerClose event should fire; it does not seem to happen for me (same problem for client+onClientClose)
Fragmenter - animated loop machine and IKONOMIKON - the memory game