Originally posted by: SUCATAT
File1.c contains reading strings sent from file2.c through read command
fd = open(i_file, O_RDONLY);
while ( 1 ) {
bytes = read(fd, buf, SIZE);
if ( bytes <= 0 ) {
fflush (stdout);
continue;
}
buf
bytes = '\0';
if ( parsing_str(buf, &str)== -1 )
printf("Failed:Syntax error in Str\n");
In other file file2.c I have a named pipe created which sends some string to first file1.c
ret = mkfifo(pipe, 0666 | O_NONBLOCK);
fd = open(pipe, O_WRONLY);
ret = pthread_create( &wr, NULL,(void *) p_wr,(void *)&fd );
if ( ret < 0 ) {
printf("Error thread\n");
exit(1);
}
void * p_wr(void *fdr)
{
int fd = *((int *)fdr);
while (1) {
fgets(msg, sizeof(msg), stdin);
if ( (strncasecmp(msg, "EXIT", 4) == 0 ))
break;
else
write(fd, message, sizeof(message));
}
the two programs are running in two different terminals. when I give ctrl+] in terminal in which file2.c is running I get a telnet prompt like this
telnet>
telnet>q
which comes out of that particular server to which I did a telnet to login and my application file1.c which is waiting for some string runs in to while loop by giving "Failed:Syntax error in Str".
I dont see this behaviour when I login into terminal(of file1.c) using ssh. Could any one suggest on this
#AIX-Forum