I'm trying to interface a software with python via a TCP connection. The software is AGWPE (in fact, it's soundmodem, but they share the same API). When I ask the software for "normal" packets, everything fine, but when I ask for "raw" packets, the hex bytes the tcp connection gives me won't decode as nothing at all. Not ASCII, not unicode, not latin-1.
This is the API of AGWPE already to the packet I'm having trouble with:http://uz7.ho.ua/includes/agwpeapi.htm#_Toc500723814
This is my code:
import socket#import aprslibraw=1TCP_IP = '127.0.0.1'TCP_PORT = 8000BUFFER_SIZE = 1024MESSAGE = '000000006D00000000000000000000000000000000000000000000000000000000000000'message2 = '000000006B00000000000000000000000000000000000000000000000000000000000000'MESSAGE = bytearray.fromhex(MESSAGE)message2 = bytearray.fromhex(message2)s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.connect((TCP_IP, TCP_PORT))s.send(MESSAGE)if raw: s.send(message2)data = s.recv(BUFFER_SIZE)dataf=data.decode("ascii", 'ignore') #not putting the second argument raises an exception#aprs=aprslib.parse(dataf)print(dataf)s.close()
And this is my result: (I would paste it but seems that notepad and the browser don't like some characters)Raw on:http://i.gyazo.com/2e6eecf99c6e79c7cdbcf868a734694b.png
I would be expecting something like on the example:
....K...LU7DID..8.LU7DID-4..B...,.E....n......n...i8...[LU7DID@LU7DID-4] B,C,D,E,X,I,M,?,N,P,U,J,R: ..
with the char 0x00 instead of . of course. At least something readable.
Thanks a lot for your time.
I've got a binary file of VS2013 project, compiled using Unicode. Now i have a need to find few data strings in this file and replace them, using my utility. My idea was to search this strings in hex-editor, look their addresses and then simple update this data using winapi CreateFile/SetFilePointer/WriteFile. But there is a problem. First - i can't find this strings in hex-editor (because of unicode) and now i don't sure how to update them, because unicode chars are two bytes long.
I am trying to convert a string like "testing123" into hexadecimal form in java. I am currently using BlueJ.
And to convert it back, is it the same thing except backward?
I need to know how to get code for foreground color if I know hexadecimal color for that color.
<string name="name">Asavbasb <font fgcolor="#33b5e5">look</font></string>
This is code for my color in hexadecimal #33b5e5, but if I use it in
fgcolor="33b5e5", selected text is white and not blue, so my question is how can I get code for that foreground color?
What is the best way to convert a string to hex and vice versa in C++?
"Hello World"to hex format: