Getting server IP address

Joe Maus jmaus at theccgllc.com
Tue Apr 14 23:05:24 EDT 2009


----- Bastiaan Olij <lists at basenlily.nl> wrote:
> Hey $All,
> 
> I'm sure this was handled a week or so ago but I can't find the topic
> anymore on the list. I want to know what the IP addresses are on which
> Omnis is listening (or just get these from the OS and assume Omnis is
> listening through those IPs). I need a solution for both Mac and Windows

Trouble here is there can be multiple interfaces running or "present" - often virtual interfaces for VPN connections and other processes are present in that list causing one to wonder what, exactly, is the correct IP to use...  Then, of course, there is DHCP and sometimes the IP can be changed and Omnis is just listening to static (although this is rare for servers) once that happens.  And then there are servers that have say 4 interfaces on them - some may be valid to listen on, others not - so how to tell from an interrogation of the OS?  Answer is you really can't.  You have to know where you'll be listening before you start it up.  And I'm pretty sure (although not 100%) Omnis will only listen on one IP at a time (as it can bind only one port for webserver, this seems to make sense logically, at least to me).  Perhaps TCPGetMyAddress will return the address Omnis is using all of the time?  (As opposed to returning just one of the IPs available to it from the network listing where that IP may not be the one it is actually bound to.)

> 
> Also does someone know how I can force Omnis to accept another port?
> I've noticed that when $serverport is not set and I set it, Omnis binds
> to that port right away, but if I change $serverport afterwards I need
> to restart Omnis before it will bind to the new port meaning $serverport
> and the actual port Omnis is listening on could be different.

Every program that I've come across requires a restart if you change the bound port.  I do not pretend to know if this is always true, just that everything I've come across requires a restart in this case.  At least in the PC world.  And yes, you need to start Omnis, enter the value, and then restart Omnis to get it to bind.  It will only bind with the port specified in $serverport - it will not bind to any other random port.  It that port is not available, it should throw an error that that port is already in use.  Use "netstat" from the command line to see the ports in use already ("netstat ?" to see all of the available parameters).

Fun with networking!  How I enjoy it...

Regards,

Joe Maus




More information about the omnisdev-en mailing list