Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-04-11
3
Medium Priority
?
1,955 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
tppradeep18 earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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