发信人: tsingxiao()
整理人: girlrong(1999-11-13 15:08:37), 站内信件
|
I gotta write a lib for C++ programmer, implement MFC's CAsyncSocket. And I met a problem now: How to detect a async connect() request's status?( failed or succeed?) Some document tell me simply "select" it as read and write, then test it's return value, but I find it's not a good idea. Can I write a sig_action to test it?(IO_RD or something else ?) Another question is: Many many article tell us: use the smart "select()", we can throw out the "fock()" but i have a question on it: If we use a "select" in a "while" loops, and use sync operation server should stop responsing when try sending data, but if we use async operation, "select" would be _blocked_ how to ?? If I can find a lib some where, that's great ……
-- 我 既不能达而兼善天下 只好穷而独善自身 青山处处 斯民如土矣……
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.252.235] ==================================================================== 发信人: wlmqth (TianTian), 信区: C 标 题: Re: about implement asyncsocket in LINUX 发信站: 网易虚拟社区 (Mon Aug 16 23:31:36 1999), 站内信件 when asyn connect connecting it will return EAGAIN or EWOULDBLOCK error;but TCP three-way hand to hand will continue;you can use "select" to check if the connection is successful! (perhaps you can use sigaction) the two macro have the same value you can check sys/errno.h to find their value; Sorry I have no enouth time to tell you the details I will go on to discuss this article recently! good luck! -- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.53.233]
=========================================================================== 发信人: tsingxiao (脑袋), 信区: C 标 题: Re: about implement asyncsocket in LINUX 发信站: 网易虚拟社区 (Tue Aug 17 08:21:02 1999), 站内信件 : ....... Yes, I can "select" it to test if the connection is OK or failed but , the socket this way is async and select would block later So, can i make the socket back to sync after connect() complete? fcntl() seemed can do this, but it seemed not working properly. I wonder I use the wrong parameter. can u give me a sample about this ? -- 我 既不能达而兼善天下 只好穷而独善自身 青山处处 斯民如土矣…… ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.101.3.51]
=========================================================================== 发信人: wlmqth (TianTian), 信区: C 标 题: Re: about implement asyncsocket in LINUX 发信站: 网易虚拟社区 (Tue Aug 17 09:13:20 1999), 站内信件 To back to syn stat, Perhaps you can try to use ioctl the mark FIOASYNC,it can clear ASYNC mark or use fcntl set F_SETFL to O_APPEND. please try. -- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.53.233]
|
|