interrupt driven socket handler.

interrupt driven socket handler.

Post by Inho Hur(NeoArtem » Wed, 24 May 1995 04:00:00



I tried to make SIGIO event handler, but I failed.('Pollable Event'
msg appeared, and I cannot figure out what can I do)

1. Is there any example SIGIO event handler function?
or
2. How can I solve the 'Pollable Event' Problem?

Thanks in advance.

 
 
 

interrupt driven socket handler.

Post by Jeff Dicks » Thu, 25 May 1995 04:00:00



>I tried to make SIGIO event handler, but I failed.('Pollable Event'
>msg appeared, and I cannot figure out what can I do)

>1. Is there any example SIGIO event handler function?
>or
>2. How can I solve the 'Pollable Event' Problem?

>Thanks in advance.

There are three steps involved. One is to declare the handler function, to
set the FASYNC flag, and the owner. Below is the main function of a program
that I wrote that talks to a specific type of communication equipment via
the serial port. If you'd like the entire program - email me. You're welcome
to it.

main(argc, argv) int argc; char *argv[]; {

    char *p1, *p2, line[MAXCOLS];
    int i, j;
    long n;
    struct termios ios;

    if (argc > 1) {
        if ((lfp = fopen(argv[1], "r")) != NULL) {
            if ((iod = open(TTYNAME, O_RDWR)) != -1) {
                for (i = 0; i < NCCS; i++)
                    ios.c_cc[i] = 0;
                ios.c_cc[VMIN] = 0;
                ios.c_cc[VTIME] = MAXIDLETIME;
                ios.c_iflag = IGNBRK;
                ios.c_oflag = 0;
                ios.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
                ios.c_lflag = 0;
                ioctl(iod, TCSETS, &ios);
                signal(SIGIO, GetScreenData);
                fcntl(iod, F_GETFL, &i);
                i |= FASYNC;
                fcntl(iod, F_SETFL, i);
                fcntl(iod, F_SETOWN, getpid());
                while ((p1 = fgets(line, sizeof(line), lfp)) != NIL) {
                    if (*p1 > ' ' || *(p1 = position(p1)) != '\0') {
                        if (*p1 != '#') {
                            if ((p2 = index(p1, '|')) != NIL) {
                                *p2++ = '\0';
                                printf("\n%s", p2);
                                collect(p1);
                            }
                        }
                    }
                }
                close(iod);
            }    
            else perror(PRGNAME);
            fclose(lfp);
        }
        else perror(PRGNAME);
    }    
    else puts("USAGE: DCP3552monitor <file>");

Quote:}    

Jeff S.*son

 
 
 

1. Interrupt driven socket I/O in SUN/Solaris2.5 ?

Hi,

I try to set up a interrupt driven socket routine that would react
on any incoming data (connection demand and normal data). I work
with AF_INET SOCK_STREAM sockets.

I cannot use fork to handle separate connections: I want to handle
them in the same program. So I have one "connection listening" socket
that accept connections and creates normal sockets. I want my interrupt
routine to test for an accept, then to read any incoming data on
the already existing sockets...

It seems that fcntl( sock, F_SETL, FASYNC ) nor fcntl( sock, F_SETOWN...)
works under solaris.

I almost succeed, but it seems that secondary sockets does not inherit
the non-blocking/interrupt-generation properties of the primary socket.

Reply by email please.

David.
+------------------------------------------+

| CEA/Cadarache, DER/SSAE/LSMI, bat 205    |
| 13108 St-Paul-Lez-Durance, FRANCE        |
| tel: (+33) 42254292  fax: (+33) 42252780 |
| http://rhum.cad.cea.fr/                  |
+------------------------------------------+

2. Unix/NT Time synchronization

3. Handlers, Handlers, Handlers

4. vmlinux VS vmlinuz??

5. Sockets and interrupt driven I/O

6. KNODE

7. Interrupt driven socket I/O

8. Solaris 9 Thread Performance...

9. Problems with interrupt handler

10. interrupt handler

11. aiee, killing interrupt handler

12. aiee, killed interrupt handler - kernel panic