The above program i have typed in linux. It basically has to connect a client and server in separate terminals. But when i run them in the correct order, i.e
- Compile server -> run server
- Compile client - > run client
The terminals just dont do anything. It doesnt even print the "Trying to connect"
part of the first printf
statement. What is the mistake here?
EDIT
I checked for return value of mkfifo
as @parapura rajkumar said. But Still it remains the same. Here is my changed code for server.
if(mkfifo("fifo1",0666)<0) {
printf("Error");
}
if(mkfifo("fifo2",0666)<0) {
printf("Error");
}
fflush(stdout);
printf
calls, it is advised to end theprintf
with a new-line (\n
) as that will flush the output so it's shown in the console. Then you don't needfflush
. – Dvina