消息队列实现回射客户/服务器

server进程接收时, 指定msgtyp为0, 从队首不断接收消息
server进程发送时, 将mtype指定为接收到的client进程的pid
client进程发送的时候, mtype指定为自己进程的pid
client进程接收时, 需要将msgtyp指定为自己进程的pid, 只接收消息类型为自己pid的消息;
附-ftok用法
描述信息:
The ftok() function uses the identity(象征) of the file named by the given pathname (which must refer
to an existing, accessible file[必须是一个已经存在,并且可访问的文件]) and the least significant(有效的) 8 bits[有效的最低8位] of proj_id (which must be nonzero) to generate a key_t type System V IPC key, suitable
for use with msgget(2), semget(2), or shmget(2). The resulting value is the same for all pathnames that name the same file, when the same value of proj_id
is used(如果文件名与proj_id的有效位全都相同的话, 则生成的key一定也是相同的). The value returned should be different when
the (simultaneously existing) files or the project IDs differ.
RETURN VALUE On success, the generated key_t value is returned. On failure -1 is returned,
with errno indicating the error as for the stat(2) system call.