LoveéD and udp socket

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

LoveéD and udp socket

Post by wazoowazoo »

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 »

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: 3087
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LoveéD and udp socket

Post by zorg »

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: 16
Joined: Sun Jan 22, 2017 2:47 pm

Re: LoveéD and udp socket

Post by wazoowazoo »

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 »

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: 16
Joined: Sun Jan 22, 2017 2:47 pm

Re: LoveéD and udp socket

Post by wazoowazoo »

His computer ports ?
User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: LoveéD and udp socket

Post by HDPLocust »

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 8 guests