TCPGetMyAddr

Kelly Burgess kellyb at montana.com
Wed Sep 21 02:54:13 UTC 2022


Hi Das,

>Is there a way to know the IP address of the local ODB Server?

Presumably the ODB server is running on a machine with an assigned fixed IP address, so I usually provide a user preference where they can enter that address, and then I get it from the prefs.


>Otherwise, what is the syntax for opening a socket to the current machine, so as to get it’s correct local IP address?

I don't think it's possible to open a socket to localhost and get a usable IP.  My Mac has a couple of ports open, one Kerberos and another IPP, but when I open a socket to those ports, TCPGetMyAddr just returns ::1.  So just open a socket to any reliably available server.

	TCPConnect ('www.gmail.com',80,kFalse,kFalse) Returns socket
	TCPGetMyAddr (socket) Returns #S1
	TCPClose (socket,0)

Or if you've got the fixed IP of your ODB Server, you'll also know the port number you're using for ODB, so try TCPConnecting to that server/port rather than gmail etc.

Kelly


More information about the omnisdev-en mailing list