Skip to main content

How to extract client connection info when Server is in the request Servicing context?

  • February 16, 2013
  • 0 replies
  • 0 views

Problem

  • Product Name: VisiBroker C
  • Product Version: 7 and later
  • Product Component: Connection Management
  • Platform/OS Version: ALL

Is there an API which can be used to retrieve client connection information from a CORBA request?

Resolution

Yes. The method is "VIS_EXT::get_client_info" and the declaration can be found at "vext.h".
Here is the sample code snippet on how to use it.

Modify "BankImpl.h" in the "basic/bank_agent" example.

#include "vext.h"

. . . . . .

 CORBA::float balance() {

    VIS_EXT::ConnectionInfo *ci = VIS_EXT::get_client_info(NULL);

    const char* client_host = ci->hostname.in();

    CORBA::UShort client_port = ci->port;

    cout << "Client Host:" << client_host << endl;

    cout << "Client Port:" << client_port << endl;

    cout << * ci << endl;  

  }

 
Note that the server must be in invocation thread to get any information. The argument is not used in querying the client, so it can be NULL.
 


#connection
#vext
#get_client_info
#c
#C
#VisiBroker
#Security