Hi…
I am trying to receive a SIGIO signal as messages are received via socket
and the way to do it
(in GNU C Library, for example) seems to be by setting file descriptor
status flag FASYNC.
The code to do that would be, more or less…
/* create socket */
if ((sock_proc=socket(AF_INET,SOCK_STREAM,0))==-1)
{
perror(“Error creando socket”);
exit(EXIT_FAILURE);
}
/* get flags mask */
if ((ret=fcntl(sock_proc,F_GETFL,0))<0)
{
perror(“Error reading socket flags”);
exit(EXIT_FAILURE);
}
/* set FASYNC in the mask */
ret|=FASYNC;
/* and finally set mask */
if ((ret=fcntl(sock_proc,F_SETFL,ret))<0)
{
perror(“Error setting socket flag for SIGIO”);
exit(EXIT_FAILURE);
}
The problem is that FASYNC is not found in fcntl.h or in any other header
file in my QNX4.25C …
I have even searched for FASYNC string in every header file and I guess that
the flag receives a new name under QNX4…
I have tried with O_SYNC and it does not work either…
Is it only a change in the name of the flag or am I doing everything the
wrong way?
If so, how to receive a SIGIO when new data arrive via socket?
Ignacio Marin
“Ignacio Marin” <nacho@atc.uniovi.es> wrote:
Hi…
Take a look at the docs – The TCP/IP programmers guide, chapter
3, the section labelled “Interrupt-driven socket I/O”. It describes
exactly how to set this up. Should be in the on-line docs as you
well.
-David
I am trying to receive a SIGIO signal as messages are received via socket
and the way to do it
(in GNU C Library, for example) seems to be by setting file descriptor
status flag FASYNC.
The code to do that would be, more or less…
/* create socket */
if ((sock_proc=socket(AF_INET,SOCK_STREAM,0))==-1)
{
perror(“Error creando socket”);
exit(EXIT_FAILURE);
}
/* get flags mask */
if ((ret=fcntl(sock_proc,F_GETFL,0))<0)
{
perror(“Error reading socket flags”);
exit(EXIT_FAILURE);
}
/* set FASYNC in the mask */
ret|=FASYNC;
/* and finally set mask */
if ((ret=fcntl(sock_proc,F_SETFL,ret))<0)
{
perror(“Error setting socket flag for SIGIO”);
exit(EXIT_FAILURE);
}
The problem is that FASYNC is not found in fcntl.h or in any other header
file in my QNX4.25C …
I have even searched for FASYNC string in every header file and I guess that
the flag receives a new name under QNX4…
I have tried with O_SYNC and it does not work either…
Is it only a change in the name of the flag or am I doing everything the
wrong way?
If so, how to receive a SIGIO when new data arrive via socket?
Ignacio Marin
–
QNX Training Services
dagibbs@qnx.com
Ooooops… sorry… I hadn’t noticed that page…
Sorry again and thanks, David…
Ignacio Marín
“David Gibbs” <dagibbs@qnx.com> escribió en el mensaje
news:95pipu$of9$1@nntp.qnx.com…
“Ignacio Marin” <> nacho@atc.uniovi.es> > wrote:
Hi…
Take a look at the docs – The TCP/IP programmers guide, chapter
3, the section labelled “Interrupt-driven socket I/O”. It describes
exactly how to set this up. Should be in the on-line docs as you
well.
-David
I am trying to receive a SIGIO signal as messages are received via
socket
and the way to do it
(in GNU C Library, for example) seems to be by setting file descriptor
status flag FASYNC.
The code to do that would be, more or less…
/* create socket */
if ((sock_proc=socket(AF_INET,SOCK_STREAM,0))==-1)
{
perror(“Error creando socket”);
exit(EXIT_FAILURE);
}
/* get flags mask */
if ((ret=fcntl(sock_proc,F_GETFL,0))<0)
{
perror(“Error reading socket flags”);
exit(EXIT_FAILURE);
}
/* set FASYNC in the mask */
ret|=FASYNC;
/* and finally set mask */
if ((ret=fcntl(sock_proc,F_SETFL,ret))<0)
{
perror(“Error setting socket flag for SIGIO”);
exit(EXIT_FAILURE);
}
The problem is that FASYNC is not found in fcntl.h or in any other
header
file in my QNX4.25C …
I have even searched for FASYNC string in every header file and I guess
that
the flag receives a new name under QNX4…
I have tried with O_SYNC and it does not work either…
Is it only a change in the name of the flag or am I doing everything the
wrong way?
If so, how to receive a SIGIO when new data arrive via socket?
Ignacio Marin
\
QNX Training Services
dagibbs@qnx.com