title: How to send a broadcast packet with specific format using Python
body: <p>I need to send a request broadcast packet to 255.255.255.255 port 1000
  I don't know how to send 0x01 as first byte and the following 4 bytes is a random number.
  Thanks you all, in advance
      import socket
      import sys</p>
  
  <pre><code>def main(message) :
      my_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      my_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST,1)
      my_socket.sendto(message, ('255.255.255.255' ,10000))
      my_socket.close()
  
  if len(sys.argv) &lt; 2 :
      sys.exit('wrong args')
  else :    
          main(sys.argv[1])
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/4sDPb.png" alt="enter image description here"></p>