连接拒绝错误的原因可能是什么? [英] What can be the reasons of connection refused errors?
问题描述
我正在尝试用 C 编写服务器程序,使用另一个客户端,例如当我尝试通过端口 2080 连接时出现此错误.
I'm trying to write a server program in C, using another client, I get this error when I try to connect through port 2080 for example.
connection refused
此错误的原因可能是什么?
What can be the reasons of this error?
推荐答案
原因可能有很多,但最常见的是:
There could be many reasons, but the most common are:
目标机器上的端口没有打开.
The port is not open on the destination machine.
目标计算机上的端口已打开,但其未决连接的积压已满.
The port is open on the destination machine, but its backlog of pending connections is full.
客户端和服务器之间的防火墙阻止访问(同时检查本地防火墙).
A firewall between the client and server is blocking access (also check local firewalls).
检查防火墙和端口打开后,使用 telnet 连接到 ip/端口以测试连接.这会消除您的应用程序中的任何潜在问题.
After checking for firewalls and that the port is open, use telnet to connect to the ip/port to test connectivity. This removes any potential issues from your application.
这篇关于连接拒绝错误的原因可能是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!