{"id":3233,"date":"2022-11-29T17:27:06","date_gmt":"2022-11-29T17:27:06","guid":{"rendered":"https:\/\/www.shieldadvanced.com\/Blog\/?p=3233"},"modified":"2022-11-29T17:27:06","modified_gmt":"2022-11-29T17:27:06","slug":"getting-the-source-ip-address-using-inet_ntop","status":"publish","type":"post","link":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/","title":{"rendered":"Getting the source IP address using inet_ntop()"},"content":{"rendered":"\n<p>We had a problem with a client system where some HA4i jobs would end abnormally due to a request to the TCP\/IP port being incorrectly formed. We need to be able to find out what IP address was sending the request so that we could determine if the request was a legitimate request or a bad actor trying to get into the system using our responder jobs.<\/p>\n\n\n\n<p>We added code to the responder jobs to try to trap the IP address the request was being sent from, a quick review of the available API&#8217;s pushed us towards using the inet_ntop() API and using the address structure that could be filled in via the accept() API. We developed a quick update to the responder jobs that would capture information and send that out to a message queue for analysis. When we checked back in we found that the address was only ever returning 0.0.0.0? This was not correct and we could not figure out why that address was being returned, nothing in the manuals indicated we had done things incorrectly.<\/p>\n\n\n\n<p>We started to debug the API&#8217;s and found that the structure was being filled in correctly but the inet_ntop() API was not returning the IP address? We went through the documentation a number of times and felt we were using the correct structures, so something must be wrong with the API&#8217;s? We raised a PMR with IBM and while IBM does not help with coding issues we did manage to get their help on why the API was not returning the address correctly. The documentation does not state which address structure needs to be passed into the call to inet_ntop() API, just that it needs to be passed a valid pointer to the source address.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>(Input) The pointer to a buffer that contains the numeric form of an IPv4 address if the <em>af<\/em> parameter is AF_INET, or the numeric form of an IPv6 address if the <em>af<\/em> parameter is AF_INET6.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><\/blockquote>\n\n\n\n<p>We needed to pass it a pointer to the address to be converted? We compared the address buffers we were passing in (the one suggested by the documentation and the one suggested by IBM).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>struct sockaddr {              \n                               \n    uint8_t       sa_len;      \n    sa_family_t   sa_family;   \n    char          sa_data&#91;14]; \n                               \n};                             \n\nstruct sockaddr_in {              \n                                  \n   uint8_t         sin_len;       \n   sa_family_t     sin_family;    \n   u_short         sin_port;      \n   struct in_addr  sin_addr;      \n   char            sin_zero&#91;8];   \n                                  \n};                                <\/code><\/pre>\n\n\n\n<p>As you can see they are the same size but the structaddr_in has a u_short prior to where the address is stored. When you pass in the pointer to inet_ntop() using the structaddr.sa_data alignment, the IP address returned is xx.xx.YY.YY. We found out that YY.YY is the start of the IP address and xx.xx relates to the u_short alignment (port), this proves that using structaddr_in.sin_addr is correct, using the structaddr.sa_data is incorrect. <\/p>\n\n\n\n<p>Reading the accept() API it also mentions using a structure structaddr_storage being passed in, we tried this and then used the _ss_align offset, it returned the 0.0.0.0 address and looking at the structure alignment you can see why.<\/p>\n\n\n\n<p>I think the IBM documentation needs to be improved, you should use the structaddr_in offsets and pass in the sin_addr offset to inet_ntop(), anything else will not work. I have added the code below that we used to test the various structures below, it is just test code but it does show how we used the structaddr_in offsets for the call to inet_ntop() that resulted in the correct IP address being returned.<\/p>\n\n\n\n<p>This is the server code, copy into a C source file and compile to a program and then do a call to the program, no parameters required. ie call library\/pgm<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;string.h>\n#include &lt;stdlib.h>\n#include &lt;sys\/types.h>\n#include &lt;sys\/socket.h>\n#include &lt;netinet\/in.h>\n#include  &lt;arpa\/inet.h>\n#include &lt;errno.h>\n#include &lt;unistd.h>\n\n#define _1KB 1024\n#define _64K _1KB * 64\n#define _CHAR_64K \"65536\"\n\nint main(int argc, char **argv) {\nint Server_Port = 3005;                                     \/\/ listening port\nint listen_sd, accept_sd = 0;                               \/\/ listen socket and accept socket\nint rc = 0;                                                 \/\/ return code\nint on = 1;                                                 \/\/ flag\nchar ip_addr&#91;17];                                           \/\/ ip address\nsocklen_t addr_len;                                         \/\/ address struct len\nstruct sockaddr_in addr;                                    \/\/ address struct\nstruct sockaddr_in addr_in;                                 \/\/ socket address\n\nmemset(&amp;addr_in, 0, sizeof(addr_in));\naddr_len = sizeof(addr_in);\nlisten_sd = socket(AF_INET, SOCK_STREAM, 0);\nif(listen_sd &lt; 0) {\n   printf(\"%s\",strerror(errno));\n   close(accept_sd);\n   exit(-1);\n   }\nsetsockopt(listen_sd,SOL_SOCKET,SO_REUSEADDR,(char *)&amp;on,sizeof(on));\nsetsockopt(listen_sd,SOL_SOCKET,SO_RCVBUF,_CHAR_64K,sizeof(_CHAR_64K));\nsetsockopt(listen_sd,SOL_SOCKET,SO_SNDBUF,_CHAR_64K,sizeof(_CHAR_64K));\nmemset(&amp;addr, 0, sizeof(addr));\naddr.sin_family = AF_INET;\naddr.sin_addr.s_addr = htonl(INADDR_ANY);\naddr.sin_port = htons(Server_Port);\nrc = bind(listen_sd,(struct sockaddr *) &amp;addr, sizeof(addr));\nrc = listen(listen_sd, 5);\nif(rc &lt; 0) {\n   printf(\"listen error : %s\",strerror(errno));\n   close(listen_sd);\n   exit(-1);\n   }\nprintf(\"Ready for client connect(). \\n\");\naccept_sd = accept(listen_sd,(struct sockaddr *)&amp;addr_in, &amp;addr_len);\ninet_ntop(AF_INET,(struct sockaddr_in *)&amp;addr_in.sin_addr,ip_addr,16);\nprintf(\"Accept address %.16s\",ip_addr);\nclose(listen_sd);\nclose(accept_sd);\nexit(0);\n} <\/code><\/pre>\n\n\n\n<p> <\/p>\n\n\n\n<p>Next is the client code, again copy the code to a C source file, compile and put onto a remote system (you can run on the same system but then you are into running multiple sessions etc. and its not really proving much, its the same address) Once its compiled on on the target system you can run the request to call the target server ie call library\/pgm &#8216;remote IP address, or remote address that can be resolved&#8217; <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;string.h>\n#include &lt;stdlib.h>\n#include &lt;sys\/socket.h>\n#include &lt;netinet\/in.h>\n#include &lt;arpa\/inet.h>\n#include &lt;netdb.h>\n#include &lt;errno.h>\n#include &lt;unistd.h>\n#include &lt;resolv.h>\n\n\/\/ function Get_Host_Addr()\n\/\/ Purpose: get the Host address.\n\/\/ @parms\n\/\/      string server name\n\/\/      struct socket address\n\/\/      int server port\n\/\/ returns 1 on sucess\n\nint Get_Host_Addr(char *server,\n                  struct sockaddr_in *addr,\n                  int Server_Port)  {\nstruct hostent *hostp;                                      \/\/ host struct pointer\n\naddr->sin_family = AF_INET;\naddr->sin_port = htons(Server_Port);\nif((addr->sin_addr.s_addr  = inet_addr(server)) == (unsigned long) INADDR_NONE)  {\n   hostp = gethostbyname(server);\n   if(hostp == (struct hostent *)NULL) {\n      printf(\"%s\",hstrerror(h_errno));\n      return -1;\n      }\n   memcpy(&amp;addr->sin_addr,hostp->h_addr,sizeof(addr->sin_addr));\n   }\nreturn 1;\n}\n\n\nint main(int argc, char** argv) {\nint i = 0;                                                  \/\/ counter\nint sd = 0;                                                 \/\/ socket descriptor\nint rc = 0;                                                 \/\/ return code\nint Server_Port = 3005;                                     \/\/ listening port\nchar server&#91;41];                                            \/\/ server address\nstruct sockaddr_in addr;                                    \/\/ address structure\n\nif((sd = socket(AF_INET, SOCK_STREAM, 0)) &lt; 0) {\n   perror(\"socket() failed\");\n   exit(-1);\n   }\nmemset(&amp;addr,0x00,sizeof(struct sockaddr_in));\naddr.sin_family = AF_INET;\naddr.sin_port = htons(Server_Port);\nfor(i = 0; i &lt; 40; i++) {\n   server&#91;i] = (argv&#91;1]&#91;i] == ' ' ) ? '\\0' : argv&#91;1]&#91;i];\n   if(argv&#91;1]&#91;i] == ' ') {\n      break;\n      }\n   }\nserver&#91;i] = '\\0';\nGet_Host_Addr(server,&amp;addr,Server_Port);\nif((rc = connect(sd,(struct sockaddr *) &amp;addr,sizeof(addr))) &lt; 0) {\n   perror(\"connect() failed\");\n   }\nclose(sd);\nexit(0);\n}                <\/code><\/pre>\n\n\n\n<p>After the call from the remote client, check the server side and you should see something similar to the following. The IP address we ran the client was &#8216;10.10.10.82&#8217; which as you can see is exactly what we saw&#8230; just press enter to end the server program.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"119\" src=\"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png\" alt=\"\" class=\"wp-image-3236\" srcset=\"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png 772w, https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image-300x46.png 300w, https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image-768x118.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>Thought we would share this just in case others wanted to to try out the inet_ntop() API and needed a helping hand. Plus we tend to refer back to the blog when looking at how to code something up so its a reminder for us in the future \ud83d\ude42<\/p>\n\n\n\n<p>Chris..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We had a problem with a client system where some HA4i jobs would end abnormally due to a request to the TCP\/IP port being incorrectly formed. We need to be able to find out what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,13],"tags":[54,68],"class_list":["post-3233","post","type-post","status-publish","format-standard","hentry","category-c-programming-system-i5","category-ibm-i","tag-c-programming","tag-ibm-i"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting the source IP address using inet_ntop() - Simply i<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting the source IP address using inet_ntop() - Simply i\" \/>\n<meta property=\"og:description\" content=\"We had a problem with a client system where some HA4i jobs would end abnormally due to a request to the TCP\/IP port being incorrectly formed. We need to be able to find out what [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/\" \/>\n<meta property=\"og:site_name\" content=\"Simply i\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/shieldadvanced\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-29T17:27:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"772\" \/>\n\t<meta property=\"og:image:height\" content=\"119\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Chris Hird\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chris Hird\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/\"},\"author\":{\"name\":\"Chris Hird\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#\\\/schema\\\/person\\\/5277cc6ead0c8417f74194f8e318bd69\"},\"headline\":\"Getting the source IP address using inet_ntop()\",\"datePublished\":\"2022-11-29T17:27:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/\"},\"wordCount\":791,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/image.png\",\"keywords\":[\"C Programming\",\"IBM i\"],\"articleSection\":[\"C Programming System i5\",\"IBM i\"],\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/\",\"name\":\"Getting the source IP address using inet_ntop() - Simply i\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/image.png\",\"datePublished\":\"2022-11-29T17:27:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/image.png\",\"contentUrl\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/image.png\",\"width\":772,\"height\":119},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/getting-the-source-ip-address-using-inet_ntop\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting the source IP address using inet_ntop()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#website\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/\",\"name\":\"Simply i\",\"description\":\"All things IBM i\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#organization\",\"name\":\"Simply i\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/cropped-LOGO_LARGE.png\",\"contentUrl\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/cropped-LOGO_LARGE.png\",\"width\":240,\"height\":67,\"caption\":\"Simply i\"},\"image\":{\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/shieldadvanced\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/10057076\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/#\\\/schema\\\/person\\\/5277cc6ead0c8417f74194f8e318bd69\",\"name\":\"Chris Hird\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2008\\\/12\\\/c_hird_11-96x96.jpg\",\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2008\\\/12\\\/c_hird_11-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/wp-content\\\/uploads\\\/2008\\\/12\\\/c_hird_11-96x96.jpg\",\"caption\":\"Chris Hird\"},\"url\":\"https:\\\/\\\/www.shieldadvanced.com\\\/Blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting the source IP address using inet_ntop() - Simply i","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/","og_locale":"en_US","og_type":"article","og_title":"Getting the source IP address using inet_ntop() - Simply i","og_description":"We had a problem with a client system where some HA4i jobs would end abnormally due to a request to the TCP\/IP port being incorrectly formed. We need to be able to find out what [&hellip;]","og_url":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/","og_site_name":"Simply i","article_publisher":"https:\/\/facebook.com\/shieldadvanced","article_published_time":"2022-11-29T17:27:06+00:00","og_image":[{"width":772,"height":119,"url":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png","type":"image\/png"}],"author":"Chris Hird","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Chris Hird","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#article","isPartOf":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/"},"author":{"name":"Chris Hird","@id":"https:\/\/www.shieldadvanced.com\/Blog\/#\/schema\/person\/5277cc6ead0c8417f74194f8e318bd69"},"headline":"Getting the source IP address using inet_ntop()","datePublished":"2022-11-29T17:27:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/"},"wordCount":791,"commentCount":0,"publisher":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/#organization"},"image":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#primaryimage"},"thumbnailUrl":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png","keywords":["C Programming","IBM i"],"articleSection":["C Programming System i5","IBM i"],"inLanguage":"en","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/","url":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/","name":"Getting the source IP address using inet_ntop() - Simply i","isPartOf":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#primaryimage"},"image":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#primaryimage"},"thumbnailUrl":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png","datePublished":"2022-11-29T17:27:06+00:00","breadcrumb":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#primaryimage","url":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png","contentUrl":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2022\/11\/image.png","width":772,"height":119},{"@type":"BreadcrumbList","@id":"https:\/\/www.shieldadvanced.com\/Blog\/getting-the-source-ip-address-using-inet_ntop\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.shieldadvanced.com\/Blog\/"},{"@type":"ListItem","position":2,"name":"Getting the source IP address using inet_ntop()"}]},{"@type":"WebSite","@id":"https:\/\/www.shieldadvanced.com\/Blog\/#website","url":"https:\/\/www.shieldadvanced.com\/Blog\/","name":"Simply i","description":"All things IBM i","publisher":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.shieldadvanced.com\/Blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/www.shieldadvanced.com\/Blog\/#organization","name":"Simply i","url":"https:\/\/www.shieldadvanced.com\/Blog\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.shieldadvanced.com\/Blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2020\/02\/cropped-LOGO_LARGE.png","contentUrl":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2020\/02\/cropped-LOGO_LARGE.png","width":240,"height":67,"caption":"Simply i"},"image":{"@id":"https:\/\/www.shieldadvanced.com\/Blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/shieldadvanced","https:\/\/www.linkedin.com\/company\/10057076"]},{"@type":"Person","@id":"https:\/\/www.shieldadvanced.com\/Blog\/#\/schema\/person\/5277cc6ead0c8417f74194f8e318bd69","name":"Chris Hird","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2008\/12\/c_hird_11-96x96.jpg","url":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2008\/12\/c_hird_11-96x96.jpg","contentUrl":"https:\/\/www.shieldadvanced.com\/Blog\/wp-content\/uploads\/2008\/12\/c_hird_11-96x96.jpg","caption":"Chris Hird"},"url":"https:\/\/www.shieldadvanced.com\/Blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/posts\/3233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/comments?post=3233"}],"version-history":[{"count":7,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/posts\/3233\/revisions"}],"predecessor-version":[{"id":3241,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/posts\/3233\/revisions\/3241"}],"wp:attachment":[{"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/media?parent=3233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/categories?post=3233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shieldadvanced.com\/Blog\/wp-json\/wp\/v2\/tags?post=3233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}