{"id":245,"date":"2017-01-02T12:07:49","date_gmt":"2017-01-02T12:07:49","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=245"},"modified":"2022-02-17T06:24:14","modified_gmt":"2022-02-17T06:24:14","slug":"converting-ip-addresses","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/c-sharp\/tcpip\/converting-ip-addresses","title":{"rendered":"Converting IP Addresses"},"content":{"rendered":"<h4>\n\tConnverting from a IPAddress to a String<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\tsTemp = IpAddress1.ToString();\r\n<\/code><\/pre>\n<h4>\n\tConnverting from a string to IP Address<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\tIPAddress address;\r\n\tif (!IPAddress.TryParse(OurIpString, out address))\r\n\t\taddress = IPAddress.Parse(&quot;255.255.255.255&quot;);\t\/\/Error - use default broadcast address\r\n<\/code><\/pre>\n<h4>\n\tConvert from IP address to bytes<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\tByte[] bytes = address.GetAddressBytes();\r\n<\/code><\/pre>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Connverting from a IPAddress to a String sTemp = IpAddress1.ToString(); Connverting from a string to IP Address IPAddress address; if (!IPAddress.TryParse(OurIpString, out address)) address = IPAddress.Parse(&quot;255.255.255.255&quot;); \/\/Error &#8211; use default broadcast address Convert from IP address to bytes Byte[] bytes = address.GetAddressBytes(); &nbsp;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-tcpip"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/245\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}