etch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Fitzner <>
Subject AW: Identification of remote server in impl
Date Mon, 09 Jan 2012 13:14:50 GMT
Hi Thomas,
When you create a new remote server instance it is possible to give an instance variable to
you local client factory via the "factory_thisx" parameter; see following function signature:

etch_status_t test_helper_remote_server_create (test _remote_server** remote_server, wchar_t*
uri, void* factory_thisx, main_client_create_func client_create);

When you connection to you server is established, the <client_create> function is called
and the parameters factory_thisx and sever forwarded to it. Now it is possible to save the
factory_thisx into your test_client_impl instance (will be created in the factory callback
function client_create). You could do this etc. by adding a new variable to the test_client_impl

Now when you receive a client directed call, you can take the thisx pointer to get you custom
instance like youVar inst = (test_client_impl(thisx))->youVar; For each connection you
should have a own test_client_impl instance with custom data.

The same is for the onSessionNotify function (client->iobjsession->_session_notify =
onSessionNotify;). You should set the function pointer to the test_client_impl instance in
the <client_create> function. After that it is possible to retrieve you custom pointer
via (test_client_impl*)thisx)->youVar.

Hope this helps!


-----Urspr√ľngliche Nachricht-----
Von: Thomas Marsh [] 
Gesendet: Donnerstag, 5. Januar 2012 01:08
Betreff: Identification of remote server in impl

Hello all,

I noticed an issue when I was implementing a client directed message. If I have multiple <interface>_remote_server
references, and I receive a client directed service method call from one of them, I cannot
tell which connection it is coming from. For example, (pseudocode)

Step 1: from client connect to multiple remote servers

test_remote_server* T1 = NULL;
test_remote_server* T2 = NULL;

test_helper_remote_server_create(&T1, uri1, .);   // T1 = 0x87c5b90
test_helper_remote_server_create(&T2, uri2, .);   // T2 = 0x9647b90

test_helper_remote_server_start_wait(&T1, 4000); test_helper_remote_server_start_wait(&T2,

Step 2: server sends a client directed message

test_remote_client* foo = ..;


Step 3: client receives message

void *testfunc(void* thisx) {
                // thisx is a test_remote_server instance printf("thisx=%p\n", thisx); //prints
something unexpected, like 0x9951b90

The problem is that this is neither of the known remote_server instances I created, and there
is no variable (like server_id) which is set so that I can make a correlation. The same issue
is true of sessionNotify events.

Am I missing something, or doing something incorrectly? If it is an issue, please let me know
and I will submit a JIRA issue.

Thanks, and guten Rutsch ins neue Jahr!

Thomas Marsh | Sr. Software Engineer | Cloud Gaming Division | GameStop | 512-343-5927

View raw message