TCPGetMyAddr
Kelly Burgess
kellyb at montana.com
Mon Sep 19 20:56:19 UTC 2022
Hi Das,
>Latest Monterey on Mac with 10.2 30204
>On that platform it returns 127.0.0.1 instead of like 192.168…
>It works on Windows and on Catalina Mac
TCPGetMyAddr() returns 127.0.0.1 here on Catalina with Studio 10.2 31315
But if I connect a socket to something and then check using that socket, I get 10.0.0.21 - my LAN address.
TCPConnect ('www.kellyb.com',80,kFalse,kFalse) Returns socket
TCPGetMyAddr (socket) Returns ipAddress
TCPClose (socket,0)
The docs say:
• It is not a mandatory requirement that a WinSock API implementation can return the local IP address, without a socket for an open connection. In this case it is likely that TCPGetMyAddr will return 0.0.0.0.
• If the local machine has more than one IP address, passing a socket eliminates ambiguity, and returns the local IP address used for the open connection.
There are additional notes re IP v4 vs v6 and Operating System and config variations:
https://omnis.net/developers/resources/onlinedocs/CommandRef/Commands_A-Z/tcpgetmyaddr.html#tcpgetmyaddr
Kelly
More information about the omnisdev-en
mailing list