Python Forum
Send raw string via socket with out any changes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send raw string via socket with out any changes
#11
(Jul-24-2019, 11:05 AM)Gribouillis Wrote: What I see in the code is that you're sending the output of con_dat() through the socket
labeler_datasend = con_dat(aa_labeler_frame)
...
labeler_socket.send(labeler_datasend)
I don't understand what con_dat() does but I see that it returns the python type str and not a type bytes because there are statements such as rawconvertdata = '' (instead of = b'') or like rawhexstring = str(rawdata), etc. So the first thing to do seems to clean up this function so that it returns the binary string that the labeller is expecting.

con_dat - it will be another def, i don't have it yet


For example: its my string:
data = '\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\x4f\x52\x44\x45\x52\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x31\x38\x39\x00\x64\x75\x70\x6b\x61\x5f\x69\x77\x6f\x6e\x6b\x69\x00\x31\x35\x39\x30\x30\x34\x37\x37\x30\x30\x32\x32\x38\x32\x38\x35\x38\x36\x00\x30\x35\x39\x30\x30\x34\x37\x37\x30\x30\x32\x36\x32\x38\x00\x38\x31\x00\x32\x30\x31\x32\x30\x30\x00\x34\x31\x30\x31\x38\x39\x00\x73\x6f\x63\x31\x31\x32\x30\x36\x31\x39\x00\x31\x32\x33\x34\x35\x36\x37\x38\x39\x30\x00\xe7\xdc'

and my string in TCP frame must look like below:
[Image: dMh0d4x]
Reply


Messages In This Thread
RE: Send raw string via socket with out any changes - by john36 - Jul-24-2019, 11:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Send data BMP180 between client and server trought module socket smalhao 0 2,864 Jul-30-2018, 12:56 PM
Last Post: smalhao
  Simple send and recive string Server/Client Epilepsy 1 2,771 May-01-2018, 08:17 PM
Last Post: ThiefOfTime

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020