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
#3
(Jul-21-2019, 08:26 PM)Gribouillis Wrote: Why don't you write
variable = b'\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\...'
What happens if you do this?

I tried:
raw_data = '\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\'
variable = "b'" + raw_data

and when i send this variable socket.send(variable) it did't work, when i tried socket.send(variable.encode()) it's worked but python send: \x01\xc2\x81\xc2\xaav\x00]D\x00\x00\x00\x00WG_


I tried just now
variable = b'\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\...'
and:
_test\convert_data_4.py "
b'\x01\x81\xaav\x00]D\x00\x00\x00\x00WG_'
Reply


Messages In This Thread
RE: Send raw string via socket with out any changes - by john36 - Jul-21-2019, 08:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Send data BMP180 between client and server trought module socket smalhao 0 2,884 Jul-30-2018, 12:56 PM
Last Post: smalhao
  Simple send and recive string Server/Client Epilepsy 1 2,820 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