I need to send the Following Data.. This is the HEX of the Data I am going to send.
I am using the Following Code.Code:16 00 00 01 XX XX XX XX
Winsock.Sendata chr(22) & chr(0) & chr(0) & chr(1)
The last 4 bytes should be filled with timeGetTime of my PC. Its a 4 byte value, so i need to send the value in hex bytes.
How do I write the timeGetTime in Hex format and send it via Winsock?
I cant use chr(timeGetTime). Is there any other Function that accepts 4 byte value?
Edit.. I used this Code. It there a better way of doing it? Especially for large numbers
Hex_Temp Code:
Dim Hex_Temp As String Dim Str As String Dim Tm As Double Tm = timeGetTime Hex_Temp = Hex(Tm) For k = 1 To 8 - Len(Hex_Temp) Hex_Temp = "0" & Hex_Temp Next k Str = Chr(Val("&H" & Mid(Hex_Temp, 7, 2))) Str = Str & Chr(Val("&H" & Mid(Hex_Temp, 5, 2))) Str = Str & Chr(Val("&H" & Mid(Hex_Temp, 3, 2))) Str = Str & Chr(Val("&H" & Mid(Hex_Temp, 1, 2)))




Reply With Quote