473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Encoding IPv4 Address to HexBinary

Please help me out
1. What is meant by HexBinary Encoding,how is this done?
2. How must i convert a IPv4 Address to HexBinary Format ???

Thnx
Fernando

Jun 20 '07 #1
3 2904
On 20 Jun, 15:32, xxyyzz <xxyyzzy...@gmail.comwrote:
Please help me out

1. What is meant by HexBinary Encoding,how is this done?
2. How must i convert a IPv4 Address to HexBinary Format ???

Thnx
Fernando
The schema datatypes spec defines a hexBinary format. You can see it
at:

http://www.w3.org/TR/xmlschema-2/#hexBinary

Basically each byte is represented by two ASCII hexadecimal
characters.

It's also common in schemas to represent IP addresses using xs:string
and then restrict that with a pattern along the lines of:

<xs:pattern value="[1-9][0-9]{0,2}(\.[1-9][0-9]{0,2}){3}"/>

You can refine the pattern if you like to take into account that you
don't get IP addresses like 876.432.354.974, but that's too much like
hard work for me!

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================

Jun 21 '07 #2
On Jun 21, 2:22 pm, use...@tech-know-ware.com wrote:
On 20 Jun, 15:32, xxyyzz <xxyyzzy...@gmail.comwrote:
Please help me out
1. What is meant by HexBinary Encoding,how is this done?
2. How must i convert a IPv4 Address to HexBinary Format ???
Thnx
Fernando

The schema datatypes spec defines a hexBinary format. You can see it
at:

http://www.w3.org/TR/xmlschema-2/#hexBinary

Basically each byte is represented by two ASCII hexadecimal
characters.

It's also common in schemas to represent IP addresses using xs:string
and then restrict that with a pattern along the lines of:

<xs:pattern value="[1-9][0-9]{0,2}(\.[1-9][0-9]{0,2}){3}"/>

You can refine the pattern if you like to take into account that you
don't get IP addresses like 876.432.354.974, but that's too much like
hard work for me!

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================
Pete,
do mean dat we convert the IP to hex and then dat hex to ASCII

ex: (90.21.2.101)

IP 90. 21. 2. 101
HEX 5a 15 02 65

HEX to ASCII

HEX 5 a 1 5 0 2 6 5
ASCII 35 61 31 35 30 32 36 35

Waiting for your response,
Thanx,
Fernando

Jun 21 '07 #3
On 21 Jun, 11:05, xxyyzz <xxyyzzy...@gmail.comwrote:
>
Pete,
do mean dat we convert the IP to hex and then dat hex to ASCII

ex: (90.21.2.101)

IP 90. 21. 2. 101
HEX 5a 15 02 65

HEX to ASCII

HEX 5 a 1 5 0 2 6 5
ASCII 35 61 31 35 30 32 36 35

Waiting for your response,
Thanx,
Fernando
Looking at it, the reference to ASCII didn't really help much!

You stop at the hex stage, then join them all up. An example in an
XML instance would be something like:

<ipv4>5a150265</ipv4>

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================

Jun 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Bear | last post by:
I was hoping to write some network utils and found an ipv4 class written by Keith Dart circa 1999. It doesn't work any longer under python 2.3. I think I found it on starship python and links to...
1
by: Don Adams | last post by:
I have this defined in my schema: <xsd:simpleType name="addressType"> <xsd:restriction base="xsd:hexBinary"> <xsd:minLength value="1"/> <xsd:maxLength value="8"/> </xsd:restriction>...
15
by: qazmlp | last post by:
What is the best & fastest way of validating an IPv4 address? Basically, the input can be either in IPAddressv4 or IPAddressv4:port format. Currently I have the following code to validate the...
0
by: Eric.Hillmuth | last post by:
I'm just getting started with postgresql and things are going pretty well. However, I seem to be having trouble connecting to my database via TCP/IP. I'm assuming that my problems are related to...
8
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must...
2
by: Valerie Hough | last post by:
My app has so far only encountered IPv4 addresses and I use: Dns.GetHostByName( "someOtherComputer", portNumber ).AddressList. Can someone please point me to an example of how to turn this into...
1
by: =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post by:
The System.Uri class is not behaving as I expect when an IPv4 address is embedded within an IPv6 address. The following test works fine, using IPv6 only: public void...
2
by: jo3c | last post by:
Hi.. Im trying to get some information out of a windows sever 2003 chinese active directory system so let's say encoding is probably big5 or utf-8 what im doing is simliar to ldapsearch in...
14
by: Simon | last post by:
Hi, is there a straight forward way of converting IPv4 to IPv6? I thought that it was just a matter of converting 32 bits to 128 bits, (by adding 96 leading 0s), but that does not seem right...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.