SMPC API

SMPC - Simple Module Procedure Call

SPC Dynamics, Omsk, Russia
(C) 2000
mail: alexey@dynamics.ru

  1. Introduction

SMPC - is a system-independed Client/Server API for communicating
between different processes on different OSes. It use most pefrormance IPC
for each OS and TCP/IP for network communications. It’s fully synchronous
with very simple C/C++ API.
SMPC was created as simple and robust mechanism for industrial
applications.
Today, SMPC implemented for various OSes (IPCs): QNX 4.x (S-R-R),
Linux (shared memory), Win32 (DDE) and Dos32 (Dynamics TCP/IP stack).
You can simply make implementation for other operating systems.

  1. Clients and Servers

Any applications may be both clients and servers. One application
may
be server for some clients and may be client for some servers. You’ll free
to select other API’s and functionality in your applications. One
application
may have several different services. Each service has an unical ID in a one
system and clients may call it using this ID.
For communicating with processes in a network you need to use a SMPC
gates. Gate is a TCP-client that implement a remote process on local side.
It’s created for each remote process that must be communicated with your
system. Gate communicate with TCP-server on other side, which call processes
using local IPC.

Local SMPC communication model:

LOCAL IPC


| Client | ----- 1.CALL ---------> | Server |
| SMPC | <---- 2.RETURN ----- | SMPC |


Network SMPC communication model:

LOCAL IPC
----------- -------- CLIENT
NODE
| Client | ----- 1.CALL ---------> | TCP |
| SMPC | <---- 8.RETURN ----- | Client |
----------- ------±–
| |
2.SEND| |7.RECV
----------- TCP/IP Network -------------|----|---------------------
3.RECV| |6.SEND
LOCAL IPC | |
-------- -±----- SERVER
NODE
| Server | <---- 4.CALL ----------- | TCP |
| SMPC | ----- 5.RETURN ----> | Server |


  1. Programming sample

CLIENT.CPP

#include <string.h>
#include <smpc/dsmpccli.h>

#define MyServer_ID 15
#define MyServer_Hello 1

class MyClient : public DSmpcClient
{
public:
MyClient(Smpc* smpc) : DSmpcClient(smpc,MyServer_ID) {}

void Hello(char* name)
{
DSmpcParam sp[] = {{name,strlen(name)+1}};
Call(MyServer_Hello,sp,1);
}
};

void main(void)
{
DSmpc* smpc = CreateSmpc();
MyClient c(smpc);
c.Hello(“World”);
delete smpc;
}


SERVER.CPP

#include <stdio.h>
#include <smpc/dsmpcsrv.h>

#define MyServer_ID 15
#define MyServer_Hello 1

class MyServer : public DSmpcServer
{
public:
MyServer(void) : DSmpcServer(MyServer_ID) {}

int Cb_Hello(void* name, dword, void*, dword&)
{
printf(“Hello, %s !!!\n”,name);
return Smpc_Success;
}
};

void main(void)
{
DSmpc* smpc = CreateSmpc();
smpc->add(new MyServer);
smpc->Run();
delete smpc;
}

You can build this sample for all operating systems listed above.
You need simple link DSMPC.LIB to your project !!!

  1. Copyright

This is FREE software.
SMPC is a trademark of SPC Dynamics, Omsk, Russia. All rights reserved.
For get a copy and more information about SMPC mailto: alexey@dynamics.ru
or call: 7-3812-297-497

You can dowload free SMPC API from ftp://ftp.qnx.com/usr/free/smpc/dsmpc.zip

Best regards,
Alexey