简体   繁体   中英

How to fix cur error: could not resolve host error

I'm learning networks (socket lib in python) and have a problem. When I make a request to this app answer on this request is an error: "Could not resolve host: POST"

Here is my code

    import socket

    sock = socket.socket()
    sock.bind(('',9091))
    
    print("DATABASE INITED")
    while True:
        sock.listen(1)
        connection, address = sock.accept()
        buf = connection.recv(64)
        if len(buf) > 0:
            print(buf)
            conn.send(buf.upper())
    
    conn.close()

And here is code to curl request

curl -d "data = 'example'" POST 127.0.0.1:9091

Query and program located on the one Linux computer.

尝试这个:

curl --data "data = 'example'" 127.0.0.1:9091

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM