다음을 통해 공유


A study on IPC options on WinCE and Windows

 

I wanted to make a client-server application that would run both on WinCE/Windows Mobile 5.0 PPC/SP and Windows.

Here is what I wanted to make:

§ A Server EXE which would have to run, both on a Win CE based device and on a Desktop machine.

§ A Client EXE which would talk to the Server. The scenario involved running several instances of client EXE running both on Desktop and Device.

The obvious choice was to write a common Server/Client code which would run both on Device and for Desktop.

So I started looking at the various IPC options that both WinCE and Windows provide to come with an intersection set and then finally choose one of the options from the set.

Surprisingly the intersection set was really small. L

Here is the result of my study.

IPC mechanisms

Windows

Win CE

References

DCOM

Supported.

Provides an option to run the Server as a OUT PROC COM component

Not Supported.

DCOM is an optional component. So you might run into the risk of not able to run your server EXE on the device.

WinCE: https://blogs.msdn.com/cenet/archive/2005/07/13/438424.aspx

File mapping/Shared memory

Supported.

File mapping is supported on Windows platform and you can use this via CreateFileMapping, MapViewOfFile, ReadFile, WriteFile APIs.

Partially Supported.

File mapping is also supported by Win CE, but there is a caveat to it. Here is what MSDN has to say:

This function will not work on a Windows CE–based platform that does not support Page-In.”

WinCE: https://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_wcesdk_win32_createfilemapping.asp (Read the Remarks Section)

Message Queues

Not Supported.

Windows does not seem to be supporting this. At least the MSDN documentation does not list this as a possible IPC mechanism.

Supported.

WinCE supports Message Queues.

You can use the CreateMsgQueue, WriteMsgQueue etc APIs to achieve it.

Windows: https://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/interprocess_communications.asp

Pipes

Supported.

Windows supports it via CreateNamedPipe, WriteFile, ReadFile etc APIs.

Not Supported.

There is no support for Pipes specifically on WinCE.

But they claim that a point-to-point message queue can be regarded as some sort of pipe.

WinCE: https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncenet/html/intercommWindowsCENETInterprocessCommunication.asp (Read the Abstract section)

MailSlots/Mailbox

Supported.

Desktop calls this Mail Slots. Take a look at: CreateMailslot, WriteFile, ReadFile etc APIs.

Not Supported.

The Mail Slot APIs are not supported on WinCE.

But there is an implementation of one-way “Mailbox” concept described in MSDN.

Win CE: https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncenet/html/intercommWindowsCENETInterprocessCommunication.asp

Sockets

Supported

Supported

Looking at all the possible options, I finally felt that Sockets would be the best way to go. Since I had so many device platforms to support, I did not wanted to take the risk of choosing something that works on Desktop and the same thing not working on even one of the Device platforms.

This is just my observation. Please let me know if there is any other option that I have missed out. Hope this helps.

 

(This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm)