gpt4 book ai didi

http - Netcat 服务器连接被拒绝

转载 作者:可可西里 更新时间:2023-11-01 16:07:45 30 4
gpt4 key购买 nike

使用 netcat,我需要创建一个简单的服务器来响应简单的 JSON 数据。

首先我尝试使用 HTML 页面:

while true ; do nc -l 8888  < index.html ; done

或者更简单:

netcat -l 8888 < index.html

然后在我的浏览器中我这样做:

http://localhost:8888/index.html

我也尝试使用 netcat 进行连接:

nc -vz 127.0.0.1 8888

其中每一个都会产生“连接被拒绝”的结果:

localhost [127.0.0.1] 8888 (ddi-tcp-1): Connection refused

如何解决此错误?

最佳答案

问题已解决。

我不得不使用

netcat -l -p 8888 < index.html

这样我就可以收听本地端口了。现在我正在工作。

关于http - Netcat 服务器连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29892831/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com