Skip to content
Snippets Groups Projects
Commit 25e540fe authored by dnsadmin's avatar dnsadmin
Browse files

IPC készül (#1)

UNIX domain socket lesz, és mivel UDP wrappert már implementáltam, illetve UNIX socket használható datagram socketként, így akkor már ezt fogom használni (nem kell csomagszeparáció stb.). Csak itt még rá kell jönni, hogy hogyan küldjek üzenetet olyanra, amit már létrehoztak, illetve hogyan "kapcsolódjak" rá...
parent c321e1f0
No related branches found
No related tags found
No related merge requests found
/*
* File: IPC_US_communicator.h
* Author: Eckl Máté <ecklm94@gmail.com>
*
* Created on 2016. május 25., 18:09
*/
#ifndef IPC_US_COMMUNICATOR_H
#define IPC_US_COMMUNICATOR_H
#include "udp_socket_wp.h"
class IPC_US_communicator
{
udp_socket_wp sock;
IPC_US_communicator(const IPC_US_communicator& orig);
public:
IPC_US_communicator(const char *socket_path);
};
#endif /* IPC_US_COMMUNICATOR_H */
/*
* File: IPC_US_communicator.cpp
* Author: Eckl Máté <ecklm94@gmail.com>
*
* Created on 2016. május 25., 18:09
*/
#include <sys/socket.h>
#include <sys/un.h>
#include "../include/IPC_US_communicator.h"
IPC_US_communicator::IPC_US_communicator(const char* socket_path) {
sockaddr_un ipc;
memset(&ipc, 0, sizeof(ipc));
ipc.sun_family = AF_UNIX;
strncpy(ipc.sun_path+1, socket_path, sizeof(ipc.sun_path)-1-1);
sock.set_domain(AF_UNIX);
sock.bind_wp((sockaddr*) &ipc, sizeof(ipc));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment