How to fix cur error: could not resolve host error
How to fix cur error: could not resolve host error
我正在学习网络(python 中的套接字库)但遇到了问题。当我向这个应用程序发出请求时,这个请求的答案是一个错误:“无法解析主机:POST”
这是我的代码
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()
这是 curl 请求的代码
curl -d "data = 'example'" POST 127.0.0.1:9091
查询和程序位于 Linux 台计算机上。
试试这个:
curl --data "data = 'example'" 127.0.0.1:9091
我正在学习网络(python 中的套接字库)但遇到了问题。当我向这个应用程序发出请求时,这个请求的答案是一个错误:“无法解析主机:POST”
这是我的代码
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()
这是 curl 请求的代码
curl -d "data = 'example'" POST 127.0.0.1:9091
查询和程序位于 Linux 台计算机上。
试试这个:
curl --data "data = 'example'" 127.0.0.1:9091