当我需要从接入点读取数据时,我在c#Tcp中遇到问题 [英] i ace problem in c# Tcp when i need to read data from access point

查看:61
本文介绍了当我需要从接入点读取数据时,我在c#Tcp中遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IOException未被取消

无法从传输连接读取数据连接尝试失败,因为连接方在一段时间后没有正确响应或建立连接失败,因为连接的主机无法响应> ;

我怎么解决这个问题

在c#

解决方案

为什么不包装您在try / catch块中的连接处理程序代码(或''using''....) - 当您捕获异常时,您可以根据抛出异常中的数据确定要采取的操作 - 例如,重试。 。



如果尝试ping连接的终点会怎样?也许你可以使用ping(你仍然需要捕获一个异常)来查看终点是否在你连接之前活着



'' G ''

IOException was unhandeled
unable to read data from the transport connection a connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host failed to respond >
how i can solve this is problem
in c#

解决方案

why don''t you wrap your connection handler code in a try/catch block (or a ''using'' ....) - when you catch the exception you can then determine what action to take based on data the in the thrown exception - eg, retry ..

What happens if you try and ping the end-point for the connection ? maybe you can use a ping (you''d still need to trap an exception) to see if the end-point is ''alive'' before you connect

''g''


这篇关于当我需要从接入点读取数据时,我在c#Tcp中遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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