Shane Gadsby
Shane Gadsby

Reputation: 1298

How to get Client IP in Lua Sockets

I'm having trouble locating how I go about getting the ip address of each client as they connect to my server, using LuaSockets; Also: I apologise if this has been answered in another post, but I could find it; Link me if this is the case.

Cheers!

Upvotes: 1

Views: 2996

Answers (2)

Alexander Gladysh
Alexander Gladysh

Reputation: 41493

Use conn:getpeername(), it returns host and port of the client.

Upvotes: 2

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

getpeername should work.

Upvotes: 1

Related Questions