Solved

vb.net -> Converting an Octet String into Byte?

Posted on 2004-04-11
3
1,925 Views
Last Modified: 2007-12-19
Hello everyone,

First a little background: I'm doing an SMPP client on vb.net, trying to communicate with my telco's SMSC. I've got the receiving part alright, but sending has got me stumped.

I have this hex value in String: "534D5050" ("SMPP"). I am currently writing it to my socket stream like this:


Dim w As New IO.StreamWriter(smppClient.GetStream)
w.Write("534D5050")
w.Flush()


Problem is, I need to send it as an octet, e.g. 53 is 00110101 in binary.

Hence, the actual data I have to send is, 00110101 1001101 1010000 1010000, but in *bytes*, not binary.

My question is, how do I go about converting hex strings into bytes?

edit: Just to clarify, using the example string "SMPP", I should send out 4 bytes instead of 8, like it is doing right now from my code above.


Thank you, and good day.
/Kev
0
Comment
Question by:orang_minyak
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
tppradeep18 earned 500 total points
ID: 10804312
hi orang_minyak

There is a nice code available at the following URL which converts HEx to byte.

http://www.codeproject.com/csharp/hexencoding.asp

hope this helps

cheers

-----
pradeep
0
 

Author Comment

by:orang_minyak
ID: 10804676
Thank you. I'm looking into it now. Converting everthing into vb.net ;)
0
 

Author Comment

by:orang_minyak
ID: 10815031
Thanks! That helped alot.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question