title: Set IP address using SIOCSIFADDR ioctl
body: <p>I am trying to get and set the IP address using the IOCTL interface on Linux.
  I am successfully able to get and set it. When I set the ip address,
  <code>ifconfig eth0</code> shows a proper IP address, but then the system gets disconnected.
  i.e. System is not pingable.
  Here's my code for setting the IP address. Please let me know if I am missing something.</p>
  
  <pre><code>struct ifreq ifr;
  in_addr_t in_addr;
  struct sockaddr_in sin;
  
  memset(&amp;ifr, 0, sizeof(struct ifreq));
  memset(&amp;sin, 0, sizeof(struct sockaddr_in));
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  sprintf(ifr.ifr_name, "eth0");
  in_addr = inet_addr("192.168.101.17");
  sin.sin_addr.s_addr = in_addr;
  memcpy(&amp;ifr.ifr_addr, &amp;sin, sizeof(struct sockaddr));
  io = ioctl(sockfd, SIOCSIFADDR, (char *)&amp;ifr);
  </code></pre>