2013.07.08_Inter Process Communication(IPC)_활용.
Intercom_server |
/****** IPC(Inter Process Communication) 소켓 내부적으로 통신하는 방법 : FILE_SOCKET *****/ #include<stdio.h> |
Intercom_Clnt |
#include<stdio.h> } |
Inter Process Communication(IPC) |
||
내부적인 통신을 하는 방법중에 FILE_SOCKET 을 이용하면 가능하다. #define FILE_SOCKET을 이용해서 상위폴더에 SMART.SOCKET 이라는 SOCKET 확장자( .SOCKET ) 를 만들어서 직접 내부적인 통신을 하는 방법이다.
cp (파일이름) ~/ -> home 디렉토리 파일 옮기기. |
makefile |
TRG = make SRC = $(TRG).c |
: make : make clean : make TRG=컴파일할파일이름 (타겟을 다시 지정) |
: 만들어진곳. home 디렉토리.
실행후 ㅎㅎ
#define __SOCKADDR_COMMON(sa_prefix) sa_family_t sa_prefix##family struct sockaddr_un { __SOCKADDR_COMMON (sun_); char sun_path[108]; /* Path name. */ }; sa_prefix <= sun sa_family_t sa_prefix##family <= sa_prefix## 이게 sun_ 로 바뀌면서 ## 때문에 family 가 붙게된다. sa_family_t sun_family typedef unsigned short int sa_family_t; // 구조체 크기가 110byte 겠다. struct sockaddr_un { sa_family_t sun_family; char sun_path[108]; /* Path name. */ }; |