Back to index

glibc  2.9
isockad.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

Go to the source code of this file.


void init_sockaddr (struct sockaddr_in *name, const char *hostname, uint16_t port)

Function Documentation

void init_sockaddr ( struct sockaddr_in name,
const char *  hostname,
uint16_t  port 

Definition at line 8 of file isockad.c.

  struct hostent *hostinfo;

  name->sin_family = AF_INET;
  name->sin_port = htons (port);
  hostinfo = gethostbyname (hostname);
  if (hostinfo == NULL) 
      fprintf (stderr, "Unknown host %s.\n", hostname);
      exit (EXIT_FAILURE);
  name->sin_addr = *(struct in_addr *) hostinfo->h_addr;

Here is the call graph for this function:

Here is the caller graph for this function: