Skip to content
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

socket.open failed #25

Closed
lparam opened this issue Jul 23, 2013 · 4 comments
Closed

socket.open failed #25

lparam opened this issue Jul 23, 2013 · 4 comments

Comments

@lparam
Copy link

lparam commented Jul 23, 2013

socket.open在连接失败的时候直接调用了error(cmd .. "failed"),这会导致后面的应用层代码无法继续执行,这个情况应该返回一个错误码,让应用层决定如何处理,如重新尝试连接

@cloudwu
Copy link
Owner

cloudwu commented Jul 23, 2013

目前建议用 pcall, 我考虑修改一下.

@cloudwu cloudwu closed this as completed Jul 23, 2013
@lparam
Copy link
Author

lparam commented Jul 23, 2013

回复太快了..谢谢.
另外,socket.write在失败的时候,没有反馈给应用层,这会导致应用层在不知道连接已经断开的情况下继续发送数据

@cloudwu
Copy link
Owner

cloudwu commented Jul 23, 2013

socket.write 比较难反馈, 因为消息可能进入一个待发送队列。 write 是非阻塞的。

@cloudwu
Copy link
Owner

cloudwu commented Jul 23, 2013

open 已经改为返回错误, 可以用 assert(socket.open(host,port))

@DeanHH DeanHH mentioned this issue Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants