|
);
}
else if(pid>0)
//parent: send commands to child
{
close(pipe_fd[0]);
w_buf[0]="003";
w_buf.="005";
w_buf.="777";
w_buf.="000";
for(i=0;i<4;i++)
write(pipe_fd.,w_buf,4);
close(pipe_fd.);
}
}
//下面是子进程的命令处理函数(特定于应用):
int handle_cmd(int cmd)
{
if((cmd<0)||(cmd>256))
//suppose child only support 256 commands
{
printf("child: inval 页码:[1] [2] [3] [4] [5] [6] 第5页、共6页 |