discussion for designing an IPC client / server API


I have to port to Windows a UNIX local communication API. On UNIX, it uses =
AF_Unix domain sockets. The common usage of this API is for 20 or 30, maybe=
 50 clients.

The discussion i want to start is to know if my choices are right or not, a=
nd if not, what your advices are. I have not a lot of experience in what i'=
m wanting to code but I am not a newbye too. I've already written such IPC =
client / server (named pipes ans shared memory). Now, I want to know what i=
s the best design for my needs above.

So here are my questions and notes :

1) Choice of IPC design

I've searched here and there (stackoverflow, or [1]) and it seems that what=
 is the closest to AF_Unix domain sockets on Windows is named pipes. Is thi=
s a good choice ?

2)I/O modes

If named pipes are the correct choice, there several possible modes :

a) Synchronous (blocking or not)
b) Overlapped asynchronous
c) Completion Routine

For the needs of my client/server design , I think that a) is not the best.

for b) MSDN has an implementation [2], but it seems that there is a problem=
 for me : in the description, it is said : "Because the same event object i=
s used for read, write, and connect operations for each instance, there is =
no way to know which operation's completion caused the event to be set to t=
he signaled state for simultaneous operations using the same pipe instance.=
" I think it can be a problem.

Does c) seem a good choice ?

3) Notification models

to handle notifications (client which is connecting, messages received) it =
depends on the choice of I/O mode. If c) is chosen, I think that either the=
se models should be used :

a) WaitForMultipleObjectsEx
b) I/O Completion Ports

I've read on internet (and also in [1]) that I/O Completion Ports are desig=
ned for high-concurrency programs, with a thousand or more clients (I would=
 need ~50 clients, maybe a bit more). Also It adds some overhead and it see=
ms that it is very difficult to get it right.

What would you advice, here ?

I stop here, and wait your advices before writing some code.

thank you

[1] http://tinyclouds.org/iocp-links.html
[2] https://msdn.microsoft.com/fr-fr/library/windows/desktop/aa365603(v=3Dv=
12/20/2016 11:24:24 AM
comp.os.programmer.win32 14523 articles. 0 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 47