Socket functions and /etc/hosts and /etc/servi​ces

I have verified that I con open a socket with either the host name or the IP address.
But can I use either the port number or the service name (from /etc/services)?
It allows me to use a string constant instead of a numeric, but it doesn't seem to work.

The string form for the port number is specifically meant to use the NI Service Locator service and nothing else. It does not link into /etc/services or anything like that at all but is a proprietary service locator solution from NI. There exist LabVIEW VIs that one can use to both query this service as well as register new services. It can be found at vi.lib/Utility/ServLocInterface.llb. The actual service used to be programmed in LabVIEW around LabVIEW 7.0 but quickly was moved to a real system service at least on Windows. Not sure if other platforms still use the VI based service implementation or have a native service deamon too, for this.
Theoretically it would be possible to create some translation program in LabVIEW that reads /etc/services and then registers them through the service locator API but I'm not sure I see a real benefit in this.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • /etc/hosts and /etc/inet/hosts

    we're running Sol10x86 11-06 and notice that there's no link between /etc/hosts and /etc/inet/hosts as there has been on some previous versions. /etc/hosts is the only file that contains all of the info for our IPMP configuration, and that seems to be enough during reboot.
    what looks at /etc/inet/hosts? any danger in making /etc/inet/hosts a link to /etc/hosts?

    I don't have a copy of 11/06, but I've never seen a default installation of Solaris without that link.
    It's certainly there in 08/07. Is there any chance that whatever process is populating /etc/hosts on your machines is breaking that link?

  • Smtp and pop3 host and port name of gmail server?????

    can any body give me smtp and pop3 host and port name of gmail server?????to send a mail......

    Just do a new initial context and lookup the datasource, in case you need other info like host name and port you can use MBEans like:
              InitialContext ctx = null;
                   // fetch managed server name by accessing the
                   // RuntimeServerMBean using the
                   // MBeanServer interface
                   ctx = new InitialContext();
                   MBeanServer server = (MBeanServer) ctx
                   ObjectName service = new ObjectName(
                   managedServerName = (String) server.getAttribute(service,

  • Running function with "Write-Host" and redirect output to file does nothing.

    I created this function:
    function TicketSolutionInformation {
    Write-Host "User has been created." -ForegroundColor Green
    TicketSolutionInformation | Out-File -filepath ("123" + ".txt") -append
    but the file 123.txt is always empty. Why ?

    Write-Host will write text to console, not pipepeline so you'll always get nothing.
    Consider changing function to this:
    function TicketSolutionInformation {
    Write-Host "User has been created." -ForegroundColor Green
    "User has been created."
    }TicketSolutionInformation -Passthru | Out-File -filepath ("123" + ".txt") -append

  • Adblocking with /etc/hosts and connman

    I'm using the hostsblock package to create a custom hosts file.
    Everything works fine with netctl+dnsmasq, but it doesn't with connman.
    It seems connman redirects all traffic to itself by writing "nameserver" in /etc/resolv.conf
    I can't ping anything. Even with a vanilla hosts file. Adding some other nameserver like "" fixes the name resolving, but doesn't block ads. Dnsmasq is not working at the same time as connman.
    Connman has a builtin dns caching server, but I can't find any documentation on how it works/how can it be configured.
    Configuring my service profile with both nameservers fixed it. Isn't there a way to set a global nameserver?
    Last edited by el mariachi (2014-01-19 13:55:58)

    The best documentation I've found is the Connman API documentation.   You might find the API document at this link interesting: … xt?id=HEAD.  Particulaly the section in properties called Nameservers and Nameservers.Configuration.  It definitely answers your question about global nameservers.  This is the API documentation, but I've found it very helpful in explaining what I might need to do using connmanctl.
    I'm not sure if any of the GUI programs would implement the feature you need, but I just took a look at connmanctl and this looked like it may have worked:
    $ connmanctl
    connmanctl> config wifi_00183991268a_426962624e65742d576972656c657373_managed_psk --nameservers
    connmanctl> exit
    Of course you will need to replace the service with name with the one that you are using on your system.  I also picked a nameserver I knew was wrong so I could see if the command actually "took".  The nameserver changed did seem to take.

  • Outlook 2010 and OWA (Hosted on Exchange Server 2010 Standard) only show 1 weeks worth of email

    Checked to see if any Filters were applied, reset to default, same result.
    Checked to see if there were any rules, there were none.
    Checked to see if there were any "Quick Steps", there were none.
    Rebuilt the user profile in Outlook, same results.
    OWA shows the same thing so I am thinking it might be a setting/problem with Exchange. Outlook and OWA are in perfect sync, they just don't show email older than a week.

    Based on the description, you could only see those messages whose age was less than one week in Outlook and OWA.
    First, I recommend you check if there is any retention policy applied to this user mailbox.
    Besides, please use the get-mailboxstatistics command to get the number of items present in the mailbox, and then compare it with what you can see in Outlook.
    Best regards,
    Belinda Ma
    TechNet Community Support

  • Having issues-/etc/hosts.deny /etc/hosts.allow!

    OK-I just did an install of Arch '09 x86_64 core on my HP Pavillion a810n AMD Athlon64 3300+. I got to the part about configuring and the directions just aren't very clear...What EXACTLY do I input to both deny/allow to be able to get on the net to install gnome/X, etc??
    Why would anyone by default have the net services turned off when to have a Viable OS you need more packages-did someone miss that?

    From the Beginners Guide:
    If you do not plan on using the ssh daemon, leave this file at the default, (empty), for added security.
    It seems you may be confusing the contents of this file with your inability to reach the network.
    What is the exact error(s) you are receiving?
    Did you leave the file empty (all lines commented out) ?

  • Web App and Virtual Host and Clustering

              How are you doing?
              What is the best way to deploy a web application using a virtual host on a clustered
              Here is what we are doing:
              o Deploy the web application on the virtual host
              o Deploy the virtual host on the cluster
              o Make the web appliation, the default application on the virtual host
              This seems to work, but I have additional questions?
              In the above deployment, looking at the deploy tab for the web application shows
              that the application is deployed to both the cluster as well as the virtual host.
              Even though we didn't explicitly deploy to the cluster! What happens if we deploy
              explicity (i.e., target) the web application to the cluster?
              What other approaches / configurations are you guys using?
              Thank you so much,
              -Bart Simpson

    Never mind, I think I have a solution. Even though e-docs say that DefaultWebApp attribute at virtual host level was deprecated as of WL 8.1 (inline with Servlet 2.3 specification) one can directly edit config.xml file and add the attribute.
    For instance, here is an example to set webapp APP1 as a default webapp for virtual host vhAPP1:
    ... />

  • Network-profiles (1) and /etc/hosts

    Hi everyone,
    i've got a few network-profiles, especially in one network I have to use a static ip to connect to the internet. The only entry in the /etc/hosts which works correctly - without any error messages - for me, is localhost.localdomain myhost
    If I use something like in front and simply add my hostname at the end, I can't connect with the Inet, unfortunately. I did not test it, but I'm pretty sure, that this host configuration won't work in any other network, where I get a dynamic IP from the DHCP. Is there a possibility to write the content of the /etc/hosts with netcfg, like the /etc/resolv.conf for example?
    MfG Skit

    Because you didn't specify what localhost was in your hosts file. It only knows of localhost.localdomain(does not imply 'localhost') and acer being the loopback.
    I think he understood that.
    'localhost' is universally understood as the loopback.
    this is some kind of 'magic' answer isn't it? the resolving doesn't come out as a miracle... and that is IMHO what needs explanation.
    his computer alone doesn't (obviously) get it because sure, it's not set. now what 'magic' makes it known when a cable is plugged in? the computer tries to reslove locally (via /etc/hosts), fails at it, and then asks the dns server about it. so I reckon the dns server is instructed on replying '' for a 'localhost' hostname request. why so? because dns servers have an option to look at their local /etc/host for resolving before delegating to bigger servers, so the dns server certainly has localhost matching in his /etc/host, and blindly replies accordingly, oblivious to the fact that he is replying about his 'own' to someone else.
    Last edited by lloeki (2008-01-16 08:24:12)

  • /etc/hosts vs DNS & sendmail

    Hi All,
    I have a question about how /etc/hosts & DNS work on a solaris 9 box.
    When I have entries in /etc/hosts that are not in DNS and I run say nslookup the utility will not find the ip. Put if I ping the entry in /etc/hosts it will find it. Basically I have a box with default sendmail and in /etc/hosts I have a entry with mailhost added to it at the end. nslookup does not find the box ping does and sendmail can't send mail to it and I can not verify that it ever worked correctly.
    1) what is up with nslookup no seeing /etc/hosts?
    2) can sendmail send to hosts per FQDN listed in /etc/hosts & use a DNS server at the same time?

    When I have entries in /etc/hosts that are not in DNS
    and I run say nslookup the utility will not find the
    ip. Correct. nslookup and /etc/hosts are controlled by /etc/nsswitch.conf.
    Files says to search /etc/hosts.
    Anything else says to use that name service.
    Put if I ping the entry in /etc/hosts it will
    find it.If it is in /etc/hosts and /etc/nsswitch.conf says to search /etc/hosts.
    and in /etc/hosts I have a entry with mailhost added
    to it at the end. nslookup does not find the box ping
    does and sendmail can't send mail to it and I can not
    verify that it ever worked correctly. Sendmail can be compiled to use or disregard name server lookups in addition to the /etc/nsswitch.conf file.
    sendmail -v e-mail_addr, should show you some basic diagnostics.
    1) what is up with nslookup no seeing /etc/hosts?That's the way it works.
    2) can sendmail send to hosts per FQDN listed in
    /etc/hosts & use a DNS server at the same time?sure, see /etc/nsswitch.conf and the sendmail compile time options.

  • Pacman ignores /etc/hosts

    I use csslayer-aur-repo which is placed on server, however sometimes returns IP of server which doesn't seem to have csslayer-aur-repo.db.tar.gz file. As a workaround i've put in /etc/hosts with an IP which works just fine. I've tested it with wget and ping, and both of them seem to use this "new" IP address. However pacman seems to ignore /etc/hosts and picks that random IP which mostly leads to "404 not found" error when doing pacman -Syu/Syy/Sy.
    Here is my /etc/hosts
    # /etc/hosts: static lookup table for host names
    #<ip-address> <> <hostname> localhost.localdomain localhost Archie
    # End of file
    and here is the repo entry from pacman.conf:
    Server =

    Yup, wget fetches … .db.tar.gz just fine and it uses the IP specified in /etc/hosts.
    Surely pacman does not deploy its own DNS server, but seems to ignore /etc/hosts. If i remove csslayer line from /etc/hosts then wget also will fail.
    [[email protected] ~]$ wget
    --2010-07-26 18:54:29--
    Łączenie się z||:80... połączono.
    Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 200 OK
    Długość: 1190 (1,2K) [application/x-gzip]
    Zapis do: `csslayer-aur-repo.db.tar.gz'
    100%[=============================================================================================================================================================================>] 1.190 --.-K/s w 0,02s
    2010-07-26 18:54:30 (72,5 KB/s) - zapisano `csslayer-aur-repo.db.tar.gz' [1190/1190]
    [[email protected] ~]$ pacman -Syu
    :: Synchronizing package databases...
    kde-unstable is up to date
    core is up to date
    extra is up to date
    community is up to date
    error: nie udało się pobrać pliku 'csslayer-aur-repo.db.tar.gz' z : Not Found
    error: failed to update csslayer-aur-repo (Not Found)
    Last edited by hash (2010-07-26 16:55:47)

  • Proper /etc/hosts for my situation

    Hello all,
    I just (finally) got set up through an ISP which assigns me (well the DSL modem) a publicly routable dynamic address.  Anyway, I've setup a hostname, and ddclient to update it, and it routes beautifully to my linux box, through the dsl modem which has the ssh port (and other services as they come up) forwarded to the proper box.
    Anyway, I was updating my /etc/hosts, and I'm wondering if I have it setup correctly.
    #<ip-address> <> <hostname> localhost.localdomain localhost XXXXXXXX XXXXXXXX regulator-pc regulator-pc.localdomain qwest-modem qwest-modem.localdomain regulator-bridge regulator-bridge.localdomain
    # End of file
    Please replace all instances of XXXXXXXX with my actual hostname.
    This box (XXXXXXXX) has a static IP of, is that line correct?
    I've left the (hostname.localdoman) stuff in my hosts lists since at one point I had a caching bind server running on my local net, but I've yet to set that up on this network.
    regulator-bridge is my dd-wrt'd wrt54g, which now is set up in client bridge mode to allow the boxes with ethernet ports to join the network (routed off the DSL modem), and so I don't have to run an ethernet cable across the living room to the DSL modem.  Works like a champ.
    Appreciate any input.

    In the etc/hosts you have add ur ip address with hostname, something like this it should be. localhost.localdomain localhost
    10.93.10.XX mysystem.localdomai
    because, i think so,so here is what my /etc/hosts file looks like unknown485b39d0b515.local.lan unknown485b39d0b515 localhost.localdomain localhostFor the below TNS lost contact error, recently I faced a similar kind of error:
    and the error i am right now getting is this
    [[email protected] ~]$ sqlplus "/as sysdba"
    SQL*Plus: Release Production on Wed Aug 8 12:03:27 2012
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    ORA-12547: TNS:lost contact
    Check your ORACLE_HOME/bin folders rights.
    $ ls -ltr oracle
    -rwxr-xr-x 1 oracle dba 25485683 Jul 2 12:02 oracle
    $ chmod 6751 oracle
    $ ls -ltr oracle
    -rwsr-s--x 1 oracle dba 25485683 Jul 2 12:02 oracle
    And check whether your user has dba group.
    This may help you..

  • /etc/hosts works but gets overwritten every boot

    On my system (10.6.8) I can edit /etc/hosts and the changes take effect immediately. The problem is that every time I reboot, my changes are overwritten. Does anyone know what could cause this? BTW this is the exact same unsolved issue found in this dead archived thread.

    "servy" is a computer on my lan that uses DHCP and registers its name with my router which serves DNS. If I comment out the line for "servy" in my hosts file, it immediately takes effect and I can successfully ping it, or lookup its address with "dscacheutil -q host -a name servy", but as soon as I reboot, the /etc/hosts file no longer has the comment in that line. It's like there's a "last known good" copy of the hosts file somewhere and OSX or some service is restoring it every boot.
    timac:~ tim$ cat /etc/hosts
    # Host Database
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.    localhost    broadcasthost
    ::1             localhost
    fe80::1%lo0    localhost   servy
    timac:~ tim$ ls -la ~/Library/LaunchAgents/
    total 32
    drwx------   6 tim  staff   204 Nov 13 19:22 .
    drwx------+ 42 tim  staff  1428 Dec  6 21:21 ..
    -rw-r--r--   1 tim  staff   892 Nov 13  2009 [email protected]t.plist
    -rw-r--r--   1 tim  staff   425 Nov 13 19:22
    -rw-r--r--   1 tim  staff   517 Nov 13 19:22
    -rw-r--r--   1 tim  staff   677 Oct 22 17:06 org.virtualbox.vboxwebsrv.plist
    timac:~ tim$ ls -la /Library/LaunchAgents/
    total 16
    drwxr-xr-x   4 root  wheel   136 Jan  9 12:31 .
    drwxrwxr-t+ 56 root  admin  1904 Mar  5  2010 ..
    -rw-r--r--   1 root  wheel   635 Sep  9 09:04
    -rw-r--r--   1 root  wheel   786 Jul 10  2011
    timac:~ tim$ ls -la /Library/LaunchDaemons/
    total 24
    drwxr-xr-x   6 root  wheel   204 Jan  9 12:31 .
    drwxrwxr-t+ 56 root  admin  1904 Mar  5  2010 ..
    -rw-r--r--   1 root  wheel   485 Aug 31  2009 com.DuetDaemon.plist
    -rw-r--r--   1 root  wheel   669 Feb 17  2011
    -rw-r--r--   1 root  wheel   562 Sep  9 09:04
    -rw-r--r--   1 root  wheel   790 Jul 10  2011
    timac:~ tim$ ls -la /Library/StartupItems/
    total 0
    drwxr-xr-x   4 root  wheel   136 Dec 31  2010 .
    drwxrwxr-t+ 56 root  admin  1904 Mar  5  2010 ..
    drwxr-xr-x   5 root  wheel   170 Jan 10 09:23 VirtualBox
    drwxr-xr-x   4 root  wheel   136 Mar  7  2010 rEFItBlesser

  • Mpc problem: getaddrinfo not checking /etc/hosts?

    The source of this question is my attempt to get mpc to contact mpd on my localhost when the internet is down. When the internet is up it works fine, but when i'm not connected to the internet, running mpc behaves as follows:
    I seem to have tracked this down to a problem in getaddrinfo (possibly in my sytem configuration?). I created a piece of test code (below) that does a gethostbyname and then a getaddrinfo. On this computer, both work when connected to the internet, but getaddrinfo fails when disconnected. I tested the same code on an ubuntu computer and it getaddrinfo worked even when disconnected from the internet.
    My /etc/hosts and /etc/host.conf seem to be set properly. glibc is 2.8-3. I would have thought that getaddrinfo having such a problem would cause more errors than just in mpc, but I haven't noticed any.
    I'd really appreciate any help.
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
    int main (void)
    struct addrinfo *addrinfo;
    int i, error;
    struct hostent *h;
    h = gethostbyname("localhost");
    if (h) {
    for (i=0; i < h->h_length - 1; i++)
    printf("%d.", h->h_addr_list[0][i]);
    printf("%d\n", h->h_addr_list[0][i]);
    } else {
    printf("no such host\n");
    error = getaddrinfo("localhost", NULL, NULL, &addrinfo);
    if (error) {
    printf("host not found: %s\n", gai_strerror(error));
    } else {
    while (addrinfo) {
    printf("%d %d %d\n",AF_INET,AF_INET6,addrinfo->ai_family);
    addrinfo = addrinfo->ai_next;
    return 0;
    $ ./hnt
    2 10 2
    2 10 2
    2 10 2
    $ sudo dhcpcd -k wlan0
    $ ./hnt
    host not found: Temporary failure in name resolution
    $ mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "localhost" not found: Temporary failure in name resolution
    Uncommented and nonblank lines of /etc/hosts:      localhost.localdomain  localhost heroine
    and /etc/host.conf:
    order hosts,bind
    multi on

    Alas, setting MPD_HOST does not help. If there is some way to give mpc an ip address instead of a hostname, that might help. Just putting as MPD_HOST doesn't work.
    I also really think there is something really weird going on with getaddrinfo.
    Thanks for the idea.
    $ MPD_HOST=localhost mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "localhost" not found: Temporary failure in name resolution
    $ MPD_HOST= mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "" not found: Address family for hostname not supported

  • /etc/hosts is ignored

    I configured my computer to use tor and dnsmasq to resolve dns queries exactly how the arch wiki said to. This seems to work fine, however, when I try to add a entry into /etc/hosts it is ignored. To fix this I tried commenting out no-resolv but it did no good. Why is it ignoring my /etc/hosts file?
    Here is my /etc/hosts file:
    # /etc/hosts: static lookup table for host names
    #<ip-address> <> <hostname> localhost.localdomain localhost
    ::1 localhost.localdomain localhost
    # End of file still works...
    Last edited by SteveDeFacto (2013-12-21 21:20:47)

    WonderWoofy wrote:If you are using dnsmasq, why not just put it in your dnsmasq.conf?  The formatting will obviously be different, but if that is what is resolving the dns, it would make more sense to put it there.
    Actually, the main reason I was trying to modify /etc/hosts is because I am wanting to build a decentralized peer-to-peer service. I need to redirect the user to localhost upon entering a url with ".mydomain" The only way I can think to do this is to add an entry into /etc/hosts.
    I just happen to be using tor/dnsmasq so my thought is that modifying /etc/hosts won't always work for people with abnormal dns configurations. I would like to understand why it is not working more than just finding a work around.

Maybe you are looking for