473,545 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2913
On 20 Jun, 15:32, xxyyzz <xxyyzzy...@gma il.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...@gma il.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...@gma il.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>5a15026 5</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
1251
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 his web site point to a non-functional server. anyone know of a simple ipv4 class I might steal... Im mean use?
1
2022
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> </xsd:simpleType> I was hoping this would allow values to be entered like "00" and "FFFFFFFFFFFFFFFF"; however,
15
20811
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 first format. Does anybody have any comment on this? Also, please suggest a mechanism to validate the second format(address:port) also. Thanks!
0
4560
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 the message I get at startup (using "postmaster -D data - i"). The postmaster starts but produces this message: LOG: could not bind IPv4 socket:...
8
2670
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 be able to receive forminformation and store that in a database and later produce it on screen on the client (just plain HTML).
2
9415
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 an IPv6 address? Thanks in advance. Chris Hough
1
2472
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 Uri_ShouldCreateValidUriFromSimpleIPv6Address() { Uri testUri = new Uri("http://:9050"); Assert.AreEqual( "http://:9050/", testUri.ToString());
2
5537
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 shell with my python script using python ldap module the result is not the correct encoding..
14
9240
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 in some/most cases. For example, 127.0.0.1, (IPv4 localhost), does not convert ::1, (IPv6 localhost)
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7808
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.