Lua Enet IPv6

General discussion about LÖVE, Lua, game development, puns, and unicorns.
EliterScripts
Citizen
Posts: 85
Joined: Sat Oct 25, 2014 7:07 pm

Lua Enet IPv6

Post by EliterScripts »

Simple question: does Lua Enet support IPv6? If so, can I get some example code just to make sure there is nothing different?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Lua Enet IPv6

Post by zorg »

No, enet doesn't; the socket lib, however, does.
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.
EliterScripts
Citizen
Posts: 85
Joined: Sat Oct 25, 2014 7:07 pm

Re: Lua Enet IPv6

Post by EliterScripts »

I believe in Internet freedom, and I believe that a major part of true Internet freedom is supporting IPv6 to the fullest obtainable extent, that I must do my part to support IPv6 in this world.

How would I go about replacing my existing code for Lua-enet for code that works with IPv6?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Lua Enet IPv6

Post by zorg »

To be fair, enet's reason for not supporting ipv6 has nothing to do with the creator supporting freedom or not, to be honest.

As for replacing, i don't know.
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.
EliterScripts
Citizen
Posts: 85
Joined: Sat Oct 25, 2014 7:07 pm

Re: Lua Enet IPv6

Post by EliterScripts »

Like, is there any libraries/solutions that are similar to lua-enet that support IPv6?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Lua Enet IPv6

Post by zorg »

yes, the socket library; alternatively, there might be an enet fork that has ipv6, i kinda remember seeing one, but that's not the "lua- branch" either.
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.
EliterScripts
Citizen
Posts: 85
Joined: Sat Oct 25, 2014 7:07 pm

Re: Lua Enet IPv6

Post by EliterScripts »

Hello,
I have looked further into Luasocket, and I have been able to successfully get a client to connect to the server by looking at some of the client/server examples on the Internet. However, I cannot seem to grasp how it all works.

I am thinking I will use TCP for my game. It will be a very fast-paced game, and my impression is that UDP does not check that the data transmitted is correct, making it not reliable. I am thinking my game's protocol needs to have packets transmitted correctly, because one character wrong could break the entire message.

With that said, I believe that I want to keep the client and server socket open for an extended period of time. However, these example code snippets open the client, send data, receive data, and close the client. I need to program this so that I can handle multiple continuous connections.

From what I understand is that on the server-side, you have server:accept() that creates a new connection (client). However, it does not create a client object for existing client connections that have just sent data to be read. So you must create a table that inserts a client object from server:accept(), set a timeout, then go through the table of clients to check if there is data to read from each.

That makes sense, but what isn't making sense is detecting if a socket is dead/closed or not (from the server). I also don't know if I should try to make a thread for each client, or if I should have 2-5 threads and split the client sockets across just a handful of threads.

Thanks!
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Lua Enet IPv6

Post by grump »

EliterScripts wrote: Tue Jan 22, 2019 5:11 am my impression is that UDP does not check that the data transmitted is correct, making it not reliable. I am thinking my game's protocol needs to have packets transmitted correctly, because one character wrong could break the entire message.
That impression is not correct. "Not reliable" in the context of UDP does not mean you will receive corrupt data. A UDP packet either arrives intact or not at all. If data gets corrupted in transit, the whole packet is simply dropped.

If that is not acceptable, because you require messages to arrive and in correct order, then TCP is usually the way to go. It's also possible to use both protocols at the same time; you could send vital state changes via TCP, and less important data (e. g. transient position updates) via UDP. It all depends on your game.
That makes sense, but what isn't making sense is detecting if a socket is dead/closed or not (from the server).
What do you mean?
EliterScripts
Citizen
Posts: 85
Joined: Sat Oct 25, 2014 7:07 pm

Re: Lua Enet IPv6

Post by EliterScripts »

Okay, now I am having issues when I have multiple clients connected/disconnected/not fully disconnected. Could any of you help me out with this code? The server is run on a separate thread, by the way.

client:
https://gist.github.com/EliterScripts/5 ... 3480d74a7f

server:
https://gist.github.com/EliterScripts/3 ... 601590245b
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Lua Enet IPv6

Post by grump »

EliterScripts wrote: Thu Jan 24, 2019 6:34 pm Okay, now I am having issues when I have multiple clients connected/disconnected/not fully disconnected
To increase your chances at getting qualified help, I suggest that you provide a better description of what those issues are, and love file(s) that replicate the issues. Some code snippets won't do it.
Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests