Jeffery, have you solved the problem? I'm trying to launch web server at Palm. The problem is that whenever I go into accept() call I'm not able to handle user's inputs. I do loose all pen events except penDown & penUp, while I need specifically penMove event. The try to minimize timeout value in accept() call leads to failure to recognize request from client (e.g IE running on desktop) and failure too hook him up. Could you or anybody else advise me what is the best way to be simultaneous handling both socket connection and Palm input events. Or just how to put them in line without any lost. -- Regards, Konstantin ---------------------- http://klyatskin.da.ru http://www.bigfoot.com/~klyatskin mailto:[EMAIL PROTECTED] > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I'm having trouble getting select to block on my socket file descriptor. > The code for initializing select is similar to that found in CmdTelnet.c, > but differs significantly other respects. For example the code below > calls bind, listen and accept, whereas CmdTelnet.c instead calls connect. > The code below is excerpted from a functioning web server (with the > exception of select properly blocking). > > Actually, select behaves as if the socket is ready for reading. Select > returns 1 and FD_ISSET(sfd, &rfsd) is true. Upon reading, however, accept > blocks until timeout (or a client connects), contrary to what select had > previously indicated. I tried setting the socket file descriptor to > non-blocking (using fcntl in NetSocket.c) but the results were same. The > equivalent code works on the linux desktop. > > Is there anything obviously wrong with the code outlined below that will > cause select to return immediately? > > Thanks. > > (Note that the code is being run on an actual device.) > > <snip> > <also snipped error checking and decls> > > err = SysLibFind("Net.lib", &AppNetRefnum); > err = NetLibOpen(AppNetRefnum, &ifErrs); > AppNetTimeout = SysTicksPerSecond() * 4; > > sfd = socket(AF_INET, SOCK_STREAM, 0); > bzero(&saddr, sizeof saddr); > saddr.sin_family = AF_INET; > saddr.sin_port = htons(PORT); > saddr.sin_addr.s_addr = INADDR_ANY; > > bind(sfd, (struct sockaddr *) &saddr, sizeof saddr); > listen(sfd, 1); > > FD_ZERO(&arfds); > FD_SET(sfd, &arfds); > nfds = sfd+1; > > while (1) { > bcopy(&arfds, &rfds, sizeof(rfds)); > num_fds=select(nfds, &rfds, (fd_set*)0, (fd_set*)0, (struct > timeval*)0) < 0) > > if (FD_ISSET(sfd, &rfds)) { > if ((fd = accept(sfd, (struct sockaddr *) &saddr, &len)) < > 0) { > printf("accept error %d\n", errno); > break; > } > } > else > continue; > > /* handle request here */ > } > > > - -- > Jeffery D. Collins > Sr. Software Developer > Endeavors Technology, Inc. > > > > -----BEGIN PGP SIGNATURE----- > Version: PGP 6.5.8 > > iQA/AwUBOeJSeDD9NH4fe/njEQLIOACgxz2eYJu8ke+XvRln+x8gJ+CV+MQAoJ90 > rEV+oBEZvvCg6vVHd+6J5C8V > =AuMt > -----END PGP SIGNATURE----- -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
