无法读取传输连接的数据:一个现有的连接被强行关闭远程主机 [英] Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host

查看:1110
本文介绍了无法读取传输连接的数据:一个现有的连接被强行关闭远程主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台服务器的应用程序,有时,当客户端尝试连接时,我收到以下错误:

I have a server app and sometimes, when the client tries to connect, I get the following error:

注:便无法从客户端或登录获取流失败是可以被我添加了catch语句文本

和在它停止线(sThread:行96)是:

and the line at which it stops ( sThread : line 96 ) is :

tcpClient = (TcpClient)client;
clientStream = tcpClient.GetStream();
sr = new StreamReader(clientStream);
sw = new StreamWriter(clientStream);

// line 96:                 
a = sr.ReadLine();

什么可能会造成这个问题?需要注意的是它不发生的时间

What may be causing this problem? Note that it doesn't happen all the time

推荐答案

此错误通常意味着目标机器上运行,但你试图连接到服务不可用。 (它要么停止,崩溃,或者是忙于另一个请求。)

This error usually means that the target machine is running, but the service that you're trying to connect to is not available. (Either it stopped, crashed, or is busy with another request.)

在英语: 到的的(远程主机/服务器/服务运行在该PC)的连接被提出,但因为服务是不可用的 那台机器上,机器没知道该怎么做的请求。

In English: The connection to the machine (remote host/server/PC that the service runs at) was made but since the service was not available on that machine, the machine didn't know what to do with the request.

如果连接到本机没有用,你会看到一个不同的错误。我忘记了它是什么,但它是沿着服务无法接通或不可用。

If the connection to the machine was not available, you'd see a different error. I forget what it is, but it's along the lines of "Service Unreachable" or "Unavailable".

编辑 - 添加

有可能的,这可能出自防火墙阻止端口,但考虑到你说这是间歇性的(有时,当客户端试图连接),这是非常不可能的。我并没有包括原来是因为我才回答裁定出来精神上。

It IS possible that this is being caused by a firewall blocking the port, but given that you say it's intermittent ("sometimes when the client tries to connect"), that's very unlikely. I didn't include that originally because I had ruled it out mentally before replying.

这篇关于无法读取传输连接的数据:一个现有的连接被强行关闭远程主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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