Why are there two networking libraries in Love?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
VoiceSelection
Prole
Posts: 1
Joined: Mon Aug 15, 2022 4:00 pm

Why are there two networking libraries in Love?

Post by VoiceSelection »

I see ENet and LuaSocket. It's not super clear which one is supported or recommended.

The documentation for networking (when I google it) comes up with (luasocket): https://love2d.org/wiki/Tutorial:Networking_with_UDP

Although the side-bar in the documentation clearly lists both luasocket and enet.

For luasocket I am seeing notes like: "When using blocking operations (network connect/read/write, or socket.sleep), the whole LÖVE main loop will be blocked, and it is usually a bad idea. So use only non-blocking operations if possible, or use it in a thread."

Is there a distinction here between enet and luasocket? Is luasocket the right choice because it supports non-blocking operations?
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Why are there two networking libraries in Love?

Post by ReFreezed »

Both are included in LÖVE, and you use whichever one fits your needs the best. See https://www.reddit.com/r/love2d/comment ... s_luaenet/

They do network stuff a bit differently. LuaSocket supports both blocking operations (TCP, which sends packages reliably and in-order), and non-blocking operations (UDP, which sends packages unreliably and out-of-order). ENet basically implements TCP using UDP, which is suitable for many games as we don't want the game to freeze while doing network stuff, but we often do want some level of reliability (but not always).
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 44 guests