Retrieving Telnet Client IP Address
Posted: Thu May 11, 2023 1:43 am
I've got Telnet working on my MODM7AE70 platform using the standard Netburner "Command" library functions. I'm interested in being able to know the IP address of the Telnet Client that logged into my board. I know that the basis for Telnet is a TCP connection (in this case on port 23). In my TCP server code when I call "accept()" I can specify a pointer to a temporary IP address and port where I can effectively read the Client IP address and port number.
Using "CmdListenOnTcpPort()" I eventually will get a File Descriptor (fp) but I don't have any direct access to the Clients IP address etc. I did some digging around in the source code in the "command.cpp" file and I can see the call to "accept()" with the IP address and port pointers set to NULL so that information is not in the Command[] structure.
Other than making up my own "RawAccept" function is there a way to get this information? I though about trying to get it by virture of having the File Descriptor but I don't see an easy way to query the socket data.
Not a critical thing, but something I'd like to be able to do.
Using "CmdListenOnTcpPort()" I eventually will get a File Descriptor (fp) but I don't have any direct access to the Clients IP address etc. I did some digging around in the source code in the "command.cpp" file and I can see the call to "accept()" with the IP address and port pointers set to NULL so that information is not in the Command[] structure.
Other than making up my own "RawAccept" function is there a way to get this information? I though about trying to get it by virture of having the File Descriptor but I don't see an easy way to query the socket data.
Not a critical thing, but something I'd like to be able to do.