Cannot get raw UDP socket to work using Python on a Linux machine with specific IP and Port
Question: I am trying to connect using Python on a Linux system to a Windows system that
is listening at a certain IP and port number using UDP socket.

I know the IP and port number but I do not know any host names. But I thought
it would be easy to just connect and send a small message. I keep getting an
error no matter how I specify the address.

    
    
    import socket
    
    
    def openSocket():
       HOST = "1.1.1.1"
       PORT = 111
       server_address = (HOST, PORT)
       s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(ETH_P_ALL) ) 
       s.connect(server_address)
       s.sendAll("HELLO") 
       s.close()
    
    
    
    openSocket()
    


Answer: You just have to read the error:

    
    
    s.connect(server_address) File "<string>", line 1, in connect TypeError: argument 1 must be string, not tuple
    

which points you directly at your `connect()` call. Now compare this to the
official python
[documentation](https://docs.python.org/2/library/socket.html#socket.SOCK_DGRAM).

I've noticed that you've wanted to generate a UDP socket, but used `RAW` as
type instead of `DGRAM`. `RAW` will give you raw network protocol level access
(ie. lower level than UDP), and can't therefore be used with `(HOST,PORT)`
tuples.

