Boost-ASIO简单的echo客户端 - 服务器不能建立连接? [英] Boost-ASIO simple echo client-server cannot establish connection?

查看:310
本文介绍了Boost-ASIO简单的echo客户端 - 服务器不能建立连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用BOOST-ASIO进行简单回音客户端 - 服务器(有一个单独的客户端和服务器的链接)。当我尝试运行服务器时,我使用 async_tcp_echo_server 4000 。对于客户端我使用 blocking_tcp_echo_client#。#。#。#4000 (用#。#。#。#作为ip地址)。我在XP-SP3与我的计算机连接到我的无线dsl调制解调器使用usb卡。在客户端几秒钟后,我收到此错误:

I'm using BOOST-ASIO for a simple echo client-server (there is a separate link for the client and server). When I try to run the server I use this async_tcp_echo_server 4000. For the client I use blocking_tcp_echo_client #.#.#.# 4000 (with #.#.#.# as the ip address). I'm on XP-SP3 with my computer connected to my wireless dsl modem using a usb card. After a few seconds on the client side I get this error:

Exception: connect: A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed be
cause connected host has failed to respond

任何想法可能是什么?我关闭了我的防火墙,包括Windows防火墙,仍然没有得到任何回应。我的港口可能在不正确的范围内吗?我需要包括一个计算机名称来指定网络上的机器(网络上有其他机器有时是活动的)?我试过运行这个在另一台计算机直接连接到dsl调制解调器和相同的问题。我做了ping我的地址,这是工作4/4数据包。

Any ideas what it could be? I turned off my firewall including the windows firewall and still I get no response. Could my port be in the incorrect range? Do I need to include a computer name to specify the machine on the network( there are other machines on the network sometimes active)? I did try running this on another computer directly connected to the dsl modem and same issue. I did ping my address and that did work for 4/4 packets.

推荐答案

这可能是各种各样的问题。因此,可以使用低级网络工具(例如 netcat )来服务服务器上的端口,并尝试使用 netcat 从客户端。这可以通过消除应用程序的网络编程代码引入的任何潜在问题来帮助简化问题。如果问题被识别为网络问题,则需要检查以下几件事:

It could be a variety of issues. Thus, it can be worthwhile to use lower level networking tools, such as netcat to serve a port on the server, and try connecting with netcat from the client side. This can help simplify the problem by removing any potential problems introduced by an application's network programming code. If the problem is identified as being a network issue, then there are a few things to check:


  • 验证服务器上的防火墙例外。 / li>
  • 验证服务器网络网关中的防火墙例外。

  • 如果服务器和客户端位于不同的网络,客户端尝试连接到服务器的外部IP,然后验证服务器的网关知道将路由到服务器的流量。这可能需要在路由设备中设置规则,例如端口转发

  • 如果服务器和客户端在同一网络上,但客户端尝试通过网络的外部IP连接到服务器,则验证网关是否支持循环回到外部IP的内部流量。

  • 使用网络分析工具(例如 Wireshark )验证包中的生存时间字段足够高,不会被丢弃。

  • Verify firewall exceptions on the server.
  • Verify firewall exceptions in the server's network gateway.
  • If the server and client are on different networks, with the client trying to connect to the server's external IP, then verify that the server's gateway knows what traffic to route to the server. This may require setting up rules, such as port forwarding, in the routing device.
  • If the server and client are on the same network, but the client is trying to connect to the server through the network's external IP, then verify that the gateway supports looping back internal traffic destined to the external IP.
  • Use a network analyzer tool, such as Wireshark, to verify that the time to live field in the packets is high enough that it will not be discarded.

这篇关于Boost-ASIO简单的echo客户端 - 服务器不能建立连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆