Hector Santos
2010-05-04 03:56:42 UTC
Folks, I revamping our internet hosting session-based RPC
client/server framework around IOCP and Async RPC and I have some
questions in create the new framework.
Background:
The current framework is a traditional client/server model where there
is main thread RPC client as a hosting listing server and each
connection spawns a new RPC client session thread. The RPC Server
offers 250+ functions API DLL library for RPC clients to use.
I have the socket IOCP layout worked out for socket connections and to
dispatch commands for the particular hosting server.
To use one command example, SEARCH, the dispatch is:
BOOL iocpDisp_Search(LPCLIENT_CTX lpCtx, char *szText)
{
//
// illustrating sync RPC call
//
SOCKET t = lpCtx->hClientSocket;
TMsgHeader msg = {0};
while (wcMailSearch(szText,msg)) {
// do something with msg
Sendf(t,"%u,%u\r\n",msg.Id, msg.Number);
msg.Id++;
}
return TRUE;
}
The goal is to make the above async RPC using IOCP notification.
I guess I am not sure of:
1) If I should have two I/O complete ports, one for sockets,
one for handling Async RPC calls.
2) How to keep/pass/separate/link the RPC_ASYNC_STATE instance with
the socket LPCLIENT_TXT instance. In other words, do I need to
initialize a unique RPC_ASYNC_STATE per async RPC function?
Overall, how should I prepare the structures for what is otherwise two
IOCP "streams"?
Would it be better to use Async RPC with a callback notification?
Thanks in advance
client/server framework around IOCP and Async RPC and I have some
questions in create the new framework.
Background:
The current framework is a traditional client/server model where there
is main thread RPC client as a hosting listing server and each
connection spawns a new RPC client session thread. The RPC Server
offers 250+ functions API DLL library for RPC clients to use.
I have the socket IOCP layout worked out for socket connections and to
dispatch commands for the particular hosting server.
To use one command example, SEARCH, the dispatch is:
BOOL iocpDisp_Search(LPCLIENT_CTX lpCtx, char *szText)
{
//
// illustrating sync RPC call
//
SOCKET t = lpCtx->hClientSocket;
TMsgHeader msg = {0};
while (wcMailSearch(szText,msg)) {
// do something with msg
Sendf(t,"%u,%u\r\n",msg.Id, msg.Number);
msg.Id++;
}
return TRUE;
}
The goal is to make the above async RPC using IOCP notification.
I guess I am not sure of:
1) If I should have two I/O complete ports, one for sockets,
one for handling Async RPC calls.
2) How to keep/pass/separate/link the RPC_ASYNC_STATE instance with
the socket LPCLIENT_TXT instance. In other words, do I need to
initialize a unique RPC_ASYNC_STATE per async RPC function?
Overall, how should I prepare the structures for what is otherwise two
IOCP "streams"?
Would it be better to use Async RPC with a callback notification?
Thanks in advance
--
HLS
HLS