title: Why my getservbyname function always return NULL?
body: <p>Right now i'm having some troubles with the <code>getservbyname()</code> function in linux mint, every time i try to get a port it returns <code>NULL</code> and i don't know what could be</p>
  
  <pre><code>   extern struct servent *get_port(char *name, char *prot) {
        struct servent *tmp;
        tmp = getservbyname(name, prot);
        if(tmp == NULL) {
          return NULL;
        }
        return tmp;
      }
  </code></pre>
  
  <p>This is how i call the function</p>
  
  <pre><code>    struct servent *port;
  
      if((port = (struct servent*)get_port("server", "tcp")) == NULL){
          perror("Error... \n");
          return -1;
      }
      printf("Got the port... \n");
  </code></pre>
  
  <p>I used the perror function to get more information about the problem, but every time i run the code i get that the function worked correctly...</p>