The method could be socketId()
And you underlined Source Port ????
socketId() is better than just ID as it is more descriptive. Other name could be localPort() as the opposite of remotePort()
Rob
Sorry Rob, I should have explained better.
I mean "socketId()" for logical id (1, 2, 3, 4) since the hardware only supports up to four connections.
I do not know how Source Port is being implemented, I believe the ethernet chip in the shield that do it automatically or the library. Anyway, probably will not be 0, 1, 2, 3, 4. And yes very random values.