Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/neutrino.h>
- #include <fcntl.h>
- #include <unistd.h>
- char *smsg="This is buffer";
- char rmsg[200];
- int coid;
- int main()
- {
- int pid_client;
- int fd;
- int pid_ser;
- char* filename="server.msg";
- pid_client=getpid();
- printf("\nI am Client %d .",pid_client);
- printf("Testing of message exchanging\n");
- fd=open(filename,O_RDONLY);
- if (fd==-1) printf("\nopen file %s error %d",filename,fd);
- else printf("file %s opennig Ok!",filename);
- read(fd,&pid_ser,sizeof(pid_ser));
- close(fd);
- printf("\nPID servera %d .",pid_ser);
- fflush(stdout);
- coid=ConnectAttach(0,pid_ser,1,0,0);
- if (coid==-1) {printf("Connection error\n");exit(1);}
- if (MsgSend(coid,smsg,strlen(smsg)+1,rmsg,sizeof(rmsg))==-1)
- {printf("Send message error\n");exit(1);}
- if (strlen(rmsg)>0) {printf("Process return %s\n",rmsg);}
- return(0);
- }
Add Comment
Please, Sign In to add comment