Solved

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

Posted on 2004-04-11
3
1,916 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
Comment Utility
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
Comment Utility
Thank you. I'm looking into it now. Converting everthing into vb.net ;)
0
 

Author Comment

by:orang_minyak
Comment Utility
Thanks! That helped alot.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now