Sending Bytes

I am looking to send bytes over a TCP socket to a game (FiveM) which will execute commands in the game, looking to turn this into a button box of some sorts, except I cannot get the command to work.

The current error I am getting is the following:

What I need to be able to see is this:

I’m very new to all of coding in Python so any help is appreciated.



Remove the spaces worked for me.

>>> string =(bytes.fromhex("434d4e440000000000190000736574726164695f20313400"))
>>> print(string)
b'CMND\x00\x00\x00\x00\x00\x19\x00\x00setradi_ 14\x00'



Hey Jim,

Thanks for the help. Either this isn’t working or my Pi Pico isn’t properly sending the data to the game correctly.

When setting up listener (Hercules) to listen on 29200 (port specified) it shows the data. However when setting up a TCP listener through node.js it doesn’t receive any data.

Any ideas?


Received my Pico W the other day, working through a few things.
Web pages working nicely, then I was going to look at socket connections to send data.
Access Point works nicely but unable to change the IP from the default.

So I am pretty much learning in sending receiving data and don’t think I can help much at this time.



Hey Levi,

I’d suggest hopping onto Wireshark on the network and sniffing the packets that’re being sent around on your socket, should help give you a better idea of what is going on. What you’re mainly looking for is that in the headers of the packets that you’re sending the listening devices’ MAC is correct and that in the TCP header the port number is what you’re expecting it to be.

There might be some other interesting low-level network issues coming into play here, but doing a little analysis with a tool like Wireshark to get a cleaner idea of what is going on would be a good place to start in my opinion

1 Like

Thanks Bryce, I will be sure to investigate and see where to go from there.

Hello, may I ask you what did you use to receive data on FiveM? Does it have a built in listening socket or did you use some sort of plugin to open a listening socket? thanks for your time