Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <sys/socket.h>
  2. #include <netinet/in.h>
  3. #include <arpa/inet.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. int main(void)
  8. {
  9.     const char *ip = "128.10.25.102";
  10.     struct sockaddr_in s1_addport;
  11.     printf("ip: %s, strlen:%zu\n",ip,strlen(ip));
  12.     inet_aton(ip,&s1_addport.sin_addr);
  13.     printf("Server IP: %s\n",inet_ntoa(s1_addport.sin_addr));
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement