You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
932 B
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "MyService.proxy.h"
#include "ipc/IpcPipeChannel.h"
#include "proxy/ProxyMarshaller.h"
#include <sys/stat.h>
#include <iostream>
int main() {
// Создание FIFO — часть пользовательского IPCкода.
mkfifo("/tmp/fifo_to_server", 0666);
mkfifo("/tmp/fifo_to_client", 0666);
// IPCуровень: канал поверх pipe.
// Клиент пишет в fifo, который читает сервер (fifo_to_server),
// и читает из fifo, в который пишет сервер (fifo_to_client).
IpcPipeChannel ch("/tmp/fifo_to_client", "/tmp/fifo_to_server");
// RPCуровень: создаём marshaller поверх канала и передаём его в прокси.
ProxyMarshaller marshaller(ch);
MyServiceProxy proxy(marshaller);
int r = proxy.add(7, 9);
std::cout << "RESULT: " << r << std::endl;
}