VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Print hexpackets with WinSock

~:. Jeff 'Capes' .:~  ()   String Manipulation   Visual Basic 5.0   Beginner   Wed 3rd February 2021

This is a simple example of converting a string data into a hex formatted (packet) view.
This will be mostly usefull when sending and receiving data with/through WinSock!
Packet displays data in hex and 'readable' characters like the packet below,
which seems to be the text you're reading right at this time!

48 65 6C 6C 6F 2C 0D 0A 0D 0A 54 68 69 73 20 69 Hello,....This.i
73 20 61 6E 20 65 78 61 6D 70 6C 65 20 6F 66 20 s.an.example.of.
63 6F 6E 76 65 72 74 69 6E 67 20 61 20 73 74 72 converting.a.str
69 6E 67 20 64 61 74 61 20 69 6E 74 6F 20 61 20 ing.data.into.a.
68 65 78 20 66 6F 72 6D 61 74 74 65 64 20 28 70 hex.formatted.(p
61 63 6B 65 74 29 20 76 69 65 77 2E 0D 0A 54 68 acket).view...Th
69 73 20 77 69 6C 6C 20 62 65 20 6D 6F 73 74 6C is.will.be.mostl
79 20 75 73 65 66 75 6C 6C 20 77 68 65 6E 20 73 y.usefull.when.s
65 6E 64 69 6E 67 20 61 6E 64 20 72 65 63 65 69 ending.and.recei
76 69 6E 67 20 64 61 74 61 20 77 69 74 68 2F 74 ving.data.with/t
68 72 6F 75 67 68 20 57 69 6E 53 6F 63 6B 21 0D hrough.WinSock!.
0A 0D 0A 50 61 63 6B 65 74 20 64 69 73 70 6C 61 ...Packet.displa
79 73 20 64 61 74 61 20 69 6E 20 68 65 78 20 61 ys.data.in.hex.a
6E 64 20 27 72 65 61 64 61 62 6C 65 27 20 63 68 nd.'readable'.ch
61 72 61 63 74 65 72 73 20 6C 69 6B 65 20 74 68 aracters.like.th
65 20 70 61 63 6B 65 74 20 62 65 6C 6F 77 2C 0D e.packet.below,.
0A 77 68 69 63 68 20 73 65 65 6D 73 20 74 6F 20 .which.seems.to.
62 65 20 74 68 65 20 74 65 78 74 20 79 6F 75 27 be.the.text.you'
72 65 20 72 65 61 64 69 6E 67 20 72 69 67 68 74 re.reading.right
20 61 74 20 74 68 69 73 20 74 69 6D 65 21 .at.this.time!


Inputs
data string (i.e.: data from WinSock (vbString))

Assumes
usefull for beginners

Returns
data in Hexpacket format

Rate Print hexpackets with WinSock (4(4 Vote))
Print hexpackets with WinSock.bas

Print hexpackets with WinSock Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters