Solved

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

Posted on 2004-04-11
3
1,921 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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

15 Experts available now in Live!

Get 1:1 Help Now