LoveéD and udp socket

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
wazoowazoo
Prole
Posts: 15
Joined: Sun Jan 22, 2017 2:47 pm

LoveéD and udp socket

Post by wazoowazoo » Sun Dec 02, 2018 2:48 pm

Hello everyone,

I've been trying to to send data via udp to a friend, but he dosen't receive anything. I don't know if it is because of the ip address (his looks like 192.168.*.*, is that the address where i should send the data to ?) or the port (he set his to 87**). Could someone show me an example of a working server and a working client ? It would be very nice ! :awesome:

User avatar
Link
Prole
Posts: 19
Joined: Tue Jun 19, 2018 4:09 am

Re: LoveéD and udp socket

Post by Link » Tue Dec 04, 2018 1:47 pm

192.168.*.* is a private (local) IP Address - are you on the same local network as your friend? It won't work otherwise.

There's a tutorial and source code on the Wiki:
https://love2d.org/wiki/Tutorial:Networking_with_UDP
https://love2d.org/wiki/Tutorial:Networ ... -TheServer
https://love2d.org/wiki/Tutorial:Networ ... -TheClient

User avatar
zorg
Party member
Posts: 2778
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LoveéD and udp socket

Post by zorg » Tue Dec 04, 2018 4:35 pm

Do note that those tutorials aren't the best, since, for one, you can indeed create the server itself with löve, and you don't need to mess around with building lua with sockets, and second, using (lua-)enet may be better than using luasocket, and both do come with löve built-in.

Also, to get your actual internet-facing public IP adress, use a website like whatismyip.com
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
wazoowazoo
Prole
Posts: 15
Joined: Sun Jan 22, 2017 2:47 pm

Re: LoveéD and udp socket

Post by wazoowazoo » Sun Dec 09, 2018 3:24 pm

Does my friend need to open his ports on his internet box so I can communicate with him without being on the same network ?

pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: LoveéD and udp socket

Post by pedrosgali » Sun Dec 09, 2018 10:09 pm

Depends, whoever is running the server needs to have open ports.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end

User avatar
wazoowazoo
Prole
Posts: 15
Joined: Sun Jan 22, 2017 2:47 pm

Re: LoveéD and udp socket

Post by wazoowazoo » Sun Dec 16, 2018 1:18 pm

His computer ports ?

User avatar
HDPLocust
Citizen
Posts: 64
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: LoveéD and udp socket

Post by HDPLocust » Wed Dec 26, 2018 3:50 pm

You or your friend must have white IP (accessible from global network) or external server (routable too) that connect users. Google NAT and ports and OSI-model.
Science and violence

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests