V12.3HF5
Active4D v5.0r37
Windows
I have now encountered two separate databases that after transferring them
from their production box to the development box, the on-startup warning
appears, "The database cannot be published". This appears to be new behavior
in 4D.
The solution has been to insert this code into the A4D_Init method within
the "If ($inStartWebServer)", before "START WEB SERVER".
The code retrieves the current IP address listened-to by 4D, then uses NTK
to get all local IP addresses on the box, then searches for the returned IP
address 4D listens to, to see if it is on the box.
If the IP address 4D is listening to is not on the box, the code sets the
database to listen to the first IP address that exists on the box, that is
NOT 127.0.0.1.
I hope this helps others!
----------------------------------------------------------------------------
--------------
// Make sure we listen to an IP Address that exists on this local machine
C_LONGINT($a;$b;$c;$d;$e)
C_LONGINT($addr)
$addr:=Get database parameter(IP Address to listen)
$a:=($addr >> 24) & 0x00FF
$b:=($addr >> 16) & 0x00FF
$c:=($addr >> 8) & 0x00FF
$d:=$addr & 0x00FF
C_TEXT($tIP_Address_to_listen)
$tIP_Address_to_listen:=String($a)+"."+String($b)+"."+String($c)+"."+String(
$d)
ARRAY TEXT($atLocal_IP_Addresses;0)
NTK Get Local Addresses ($atLocal_IP_Addresses)
$e:=Find in array($atLocal_IP_Addresses;$tIP_Address_to_listen)
If ($e=-1)
If (Size of array($atLocal_IP_Addresses)#1)
$f:=Find in array($atLocal_IP_Addresses;"127.0.0.1")
If ($f#-1)
DELETE FROM ARRAY($atLocal_IP_Addresses;$f)
End if
End if
ARRAY LONGINT($anIP;0)
BB_TextToArray ($atLocal_IP_Addresses{1};->$anIP;".") // BB Component method
converts text to arrays using delimiter free @ bbsp.com
If (Size of array($anIP)=4)
C_LONGINT($addr)
$addr:=($anIP{1} << 24) | ($anIP{2} << 16) | ($anIP{3} << 8) | $anIP{4}
SET DATABASE PARAMETER(IP Address to listen;$addr)
End if
End if //($e=-1)
----------------------------------------------------------------------------
---------------
David Ringsmuth
_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/