请问下 ACE_Asynch_Acceptor accepte Open 这个方法里面参数的含义

wujinlongtiaotiao 2011-06-27 01:49:47
求助 各位大大下
ACE_Asynch_Acceptor 这个 类型里面 Open 方法里面的参数各是什么含义
virtual int open (const ACE_INET_Addr &address,
size_t bytes_to_read = 0,
bool pass_addresses = false,
int backlog = ACE_DEFAULT_ASYNCH_BACKLOG,
int reuse_addr = 1,
ACE_Proactor *proactor = 0,
bool validate_new_connection = false,
int reissue_accept = 1,
int number_of_initial_accepts = -1);
...全文
230 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
冻结 2011-06-28
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 wujinlongtiaotiao 的回复:]

主要想请教下 这两个参数的确切含义: 感觉这两个参数好像很重要的感觉
int backlog = ACE_DEFAULT_ASYNCH_BACKLOG,
int number_of_initial_accepts = -1
[/Quote]

int backlog = ACE_DEFAULT_ASYNCH_BACKLOG,
应该等同于 listen(int socketfd, int backlog); 即已连接socket队列的大小。可能要*1.5.

int number_of_initial_accepts = -1 不明,不过也应该不重要,不用关注。
给第一个参数就好了。
赵4老师 2011-06-28
  • 打赏
  • 举报
回复
英语也是一门计算机语言的说。
http://www.google.com/codesearch
wujinlongtiaotiao 2011-06-28
  • 打赏
  • 举报
回复
主要想请教下 这两个参数的确切含义: 感觉这两个参数好像很重要的感觉
int backlog = ACE_DEFAULT_ASYNCH_BACKLOG,
int number_of_initial_accepts = -1
冻结 2011-06-28
  • 打赏
  • 举报
回复
open(12345);
就应该OK了,其中12345 是你服务器的监听端口号。
wujinlongtiaotiao 2011-06-28
  • 打赏
  • 举报
回复
UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP UP
wujinlongtiaotiao 2011-06-28
  • 打赏
  • 举报
回复
自己UP 一下 不想沉下去
主要是 我的英文比较蹩脚, 看了之后只有一个很模糊的概念, 所以希望有个大大可以用中文提供一个比较清晰的概念
至善者善之敌 2011-06-27
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zhao4zhong1 的回复:]
ACE中文资料http://download.csdn.net/source/1753767
[/Quote]
+++++1
赵4老师 2011-06-27
  • 打赏
  • 举报
回复
赵4老师 2011-06-27
  • 打赏
  • 举报
回复
template<class HANDLER>
int ACE_Asynch_Acceptor< HANDLER >::open ( const ACE_INET_Addr & address,
size_t bytes_to_read = 0,
int pass_addresses = 0,
int backlog = ACE_DEFAULT_BACKLOG,
int reuse_addr = 1,
ACE_Proactor * proactor = 0,
int validate_new_connection = 0,
int reissue_accept = 1,
int number_of_initial_accepts = -1
) [virtual]

open starts one or more asynchronous accept requests on a address. Each accept operation may optionally read an initial buffer from the new connection when accepted.

Parameters:
address The address to listen/accept connections on. If the address does not specify a port, a random port is selected and bound.
bytes_to_read Optional, specifies the maximum number of bytes to read with the accept. The buffer for the initial data is allocated internally and passed to the ACE_Service_Handler::open() hook method. It is legitimate only during the open() method and must be copied if required after open() returns. This pre-read function works only on Windows.
pass_addresses Optional, a non-zero value indicates that the local and peer addresses should be passed to the associated ACE_Service_Handler::addresses() method after any call to validate_new_connection() and prior to the open() hook method call.
backlog Optional, defaulting to ACE_DEFAULT_BACKLOG (which can be adjusted in your platform's config.h file). Specifies the listening backlog for the listening socket.
reuse_addr Optional, indicates whether the SO_REUSEADDR option is set on the listening socket or not.
proactor Optional, pointer to the ACE_Proactor to use for demultiplexing asynchronous accepts. If 0, the process's singleton ACE_Proactor is used.
validate_new_connection Optional, if non-zero, this object's validate_connection() method is called after the accept completes, but before the service handler's open() hook method is called. If validate_connection() returns -1, the newly-accepted socket is immediately closed, and the addresses() method is not called.
reissue_accept Optional, if non-zero (the default), a new asynchronous accept operation is started after each completion, whether the completion is for success or failure, and whether or not a successfully-accepted connection is subsequently refused.
number_of_initial_accepts Optional, the number of asynchronous accepts that are started immediately. If -1 (the default), the value of backlog is used.

Note:
On Windows, the peer address is only available at the time the connection is accepted. Therefore, if you require the peer address on Windows, do not rely on the ACE_SOCK::get_remote_addr() method - it won't work. You must supply a non-zero value for pass_addresses and obtain the peer address in the ACE_Service_Handler::addresses() method.
See also:
ACE_INET_Addr , ACE_Service_Handler
就想叫yoko 2011-06-27
  • 打赏
  • 举报
回复
http://www.aoc.nrao.edu/php/tjuerges/ALMA/ACE-5.5.2/html/ace/classACE__Asynch__Accept.html#a2

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧