I need to know how too send a packet to the server in hex any ideas thank you :)
Printable View
I need to know how too send a packet to the server in hex any ideas thank you :)
Please elaborate!
1) What do you mean by hex? "send a packet to the server in hex" is too ambiguous.
2) What are you trying to do?
Language?
I would like to connect to a remote host send a line of data in hex not text.
Why? The only way to do that would be to loop thru the line of text, and use the HEX() function to convert each letter's ASC() value into a hex character.
I added a space between each character in this example
VB Code:
Option Explicit Private Sub Form_Load() Dim msg$ msg = StringToHex("David") MsgBox msg MsgBox HexToString(msg) End Sub Function HexToString(ByVal sText As String) As String Dim saHex() As String, i As Long saHex = Split(sText) For i = 0 To UBound(saHex) HexToString = HexToString & ChrW("&H" & saHex(i)) Next End Function Function StringToHex(ByVal tIn As String) As String Dim tout$ Dim x As Integer tIn = "David" For x = 1 To Len(tIn) tout = tout & CStr(Hex(Asc(Mid(tIn, x, 1)))) & " " Next x tout = Left$(tout, Len(tout) - 1) StringToHex = tout ' 44 61 76 69 64 End Function
I also added a conversion back. As you see, the strings are a lot bigger if they are in hex separated by spaces (so that they can be split.
thanks man