[Ace-users] Re: ACE_Asynch_Acceptor::validate_connection()
faladay at gmail.com
faladay at gmail.com
Wed Sep 26 20:47:16 CDT 2007
On 9 20 , 5 07 , joe <joel... at hotmail.com> wrote:
> Subject: ACE_Asynch_Acceptor::validate_connection()
> ACE VERSION: 5.5.10
> HOST MACHINE and OPERATING SYSTEM: winxp
> COMPILER NAME AND VERSION (AND PATCHLEVEL): g++
> THE $ACE_ROOT/ace/config.h FILE : #include "ace/config-win32.h"
> THE $ACE_ROOT/include/makeinclude/platform_macros.GNU
> FILE :platform_macros.GNU
> DESCRIPTION: Can i recv a message in validate_connection() to vertify
> a correctly connection, but through ip?i have a hello message from
> client to server.
>
> Can i recv a message in validate_connection() to vertify a correctly
> connection, but through ip?i have a hello message from client to
> server.
>
> int HA_Proactive_Acceptor::validate_connection(
> const ACE_Asynch_Accept::Result& result, const ACE_INET_Addr&
> remote,
> const ACE_INET_Addr& local) {
>
> if (!result.success() || result.accept_handle() ==
> ACE_INVALID_HANDLE) {
> return -1;
> }
>
> ACE_TCHAR peer_name[MAXHOSTNAMELEN];
> ACE_INET_Addr peer_addr;
> if (remote.addr_to_string(peer_name, MAXHOSTNAMELEN) == 0) {
> ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Connection from %s\n"),
> peer_name));
> }
>
> //use which sock_stream for recv or can`t do this at all?
>
> return 0;
>
> }
u can do it like this :
ACE_HANDLE handle = result.accept_handle();
char buffer[BUFFER_SIZE + 1];
ACE_Time_Value time_out(60);
ACE_SOCK_STREAM iostream(handle);
int length = iostream.recv(buffer, BUFFER_SIZE, &time_out);
More information about the Ace-users
mailing list