-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 TcpConnection.Connect()没有反应结果,如何捕获连接的异常? #16
Comments
直接使用trycatch捕获这个接口的异常即可 |
有一种情况没有走进异常情况,也没捕获异常,有链接超时接口吗 |
我使用connect链接一个地址,什么反应都没有,后来发现是地址输错了,然后我想在这里加一个回调,例如连接超时或者地址不存在的异常以做提醒 |
连接超时用系统的timeout,系统会在连接是抛出各种异常,可以通过connect接口捕获到 |
你说的这个系统的timeout具体是指哪个?可以给一个链接吗 |
收发,连接...都有超时设置,查下官方文档 |
收发能看到,但是链接没有。。。 |
connect系统有默认的超时时间,等待超时后抛出异常,如果不想等待那么久自己写逻辑处理超时,源码里面有提供socket对象,可以对它进行操作,比如: 多查下资料,这种网上方案很多.. |
我看了下源码,connect()方法最终调用了BeginConnect()。 请问如何处理 |
既然异常在asynccallback中被抛出,可以在callback中捕获异常做对应的处理. |
No description provided.
The text was updated successfully, but these errors were encountered: