Socket.port readonly property



The Socket.port property gets the port number used to create the Socket.

Example

local net = require "net" -- create and connect a client TCP socket to the host "google.com" local socket = net.Socket("google.com", 80) -- outputs 80 print("port = "..socket.port)