import os, sys, re, socket
#import commands
from server import Server
-from Utils_Identity import getShortHostName
+from salome_utils import getShortHostName
from launchConfigureParser import verbose
# -----------------------------------------------------------------------------
except:
pass
- if verbose(): print "Name Service... ",
- #hname=os.environ["HOST"] #commands.getoutput("hostname")
- if sys.platform == "win32":
- hname = getShortHostName();
- else:
- hname = socket.gethostname();
- #print "hname=",hname
+ if verbose(): print "Name Service... "
+ hname = getShortHostName()
with open(os.environ["OMNIORB_CONFIG"]) as f:
ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
import subprocess
import re
from salomeContextUtils import getScriptsAndArgs, formatScriptsAndArgs, getShortAndExtraArgs
-from salome_utils import getUserName
+from salome_utils import getUserName, getShortHostName
# Use to display newlines (\n) in epilog
class MyParser(OptionParser):
else:
if not host:
# only PORT is given
- host = socket.gethostname()
+ host = getShortHostName()
# both MACHINE and PORT are given
_writeConfigFile(port, host)
#
os.environ['NSHOST'] = host
# determine running mode, taht is either 'local' or 'remote'
- here = socket.gethostname()
+ here = getShortHostName()
mode = "local"
if host != here and host != "localhost" and host != "no_host":
mode="remote"
3. if fails, try HOST environment variable
4. if fails, return 'unknown' as default host name
"""
- import os
try:
import socket
host = socket.gethostname()
if not host: host = os.getenv("HOSTNAME")
if not host: host = os.getenv("HOST")
if not host: host = "unknown" # 'unknown' is default host name
+ try:
+ socket.gethostbyname(host)
+ except:
+ host = "localhost"
+ pass
return host
# ---
#endif
const hostent* pour_adip=gethostbyname(hostid.nodename);
+ if(pour_adip == NULL)
+ pour_adip=gethostbyname("localhost");
ASSERT(pour_adip!=NULL);
const in_addr ip_addr=*(struct in_addr*)(pour_adip->h_addr) ;
return duplicate(inet_ntoa(ip_addr));