zap@front.se (Svante Lindahl) (06/02/89)
[First, I'm not a PC-user/programmer/lover and I haven't been following this newsgroup very close so this may be old hat to the regular readers. Sorry about that. No flames please. Mail replies, I'll summarize to the newsgroup if there is demand and I get useful replies.] We're looking for an IP/UDP/TCP-product for a 386-based PC. This is for a commercial product that we want to develop, so packages with restrictions like "non-commercial usage only" are not interesting. Vendor support is highly desirable, but a superior unsupported product might be interesting. My impression of this market is that the main products are FTP Software's PC/TCP and PC-NFS from Sun. Correct? Since I need/want UDP, I searched in the "DDN Protocol Implementation and Vendors Guide" (Feb '89), and as far as I could tell only a few packages provided support for UDP. Among those were PC-NFS but not PC/TCP. Correct? (When I read between the lines in the DDN Guide I realize that PC/TCP probably does UDP since it is said to support the domain name protocol. Correct?) One of the things we would like to do is broadcasts over UDP. It would be nice if the broadcast address was configurable to use either the old style (all zeros or net.zeros) or the new style (all ones or net.ones). New-style only is not very useful yet (sigh...). Please warn us of any implementation that supports UDP but not broadcasts over UDP. (More reading between the lines gives me the impression that PC-NFS does broadcasts, since it says they supports RARP. Correct? How about PC/TCP?) How are the programmer's toolkits for these products? Both PC/TCP and PC-NFS supports a Berkeley style socket interface according to the DDN Guide. This is fine, that's what I'm used to. How well is select() supported? How many descriptors can be in the mask to select? What is the timer resolution for the timeout parameter of select? Does a NULL-pointer as the timeout parameter imply that the descriptors are polled for pending IO? Other similarities/differences between the two (or a third product you recommend we use instead)? If PC/TCP doesn't do UDP, but has a much better toolkit we might consider redesigning our application to use only TCP. PC/TCP is said to support multiple network connections, does this mean it can have several clients connected to the same port concurrently? How about PC-NFS, can it handle multiple network connections on the same port? [What I'd like to be able to do is a server accepting multiple connections, something along these lines (BSD-type code minus error checking): FD_ZERO(&mask); /* clear mask */ /* initalize udp socket (assume udp_addr already initialized) */ udpsock = socket(AF_INET, SOCK_DGRAM, 0); bind(udpsock, (struct sockaddr *)&udp_addr, sizeof(udp_addr)); FD_SET(udpsock, &mask); /* initalize tcp socket (assume tcp_addr already initialized) */ tcp_mastersock = socket(AF_INET, SOCK_STREAM, 0); bind(tcp_mastersock, (struct sockaddr *)&tcp_addr, sizeof(tcp_addr)); listen(tcp_mastersock, SOMAXCONN); FD_SET(tcp_mastersock, &mask); for (;;) { ready = mask; /* wait for IO or timeout */ nfds = select(bits, &ready, (fd_set *)0, (fd_set *)0, &timeout); if (nfds > 0 && FD_ISSET(tcp_mastersock, &ready)) { /* accept new tcp client connection */ newsock = accept(tcp_mastersock, (struct sockaddr *)0, (int *)0); connections[newsock].flag |= CONNECTED; FD_SET(newsock, &mask); nfds--; } if (nfds > 0 && FD_ISSET(udpsock, &ready)) { /* query over udp, sort of like an RPC server */ handle_udp_request(udpsock); nfds--; } /* take care of any queries from one of the connected tcp clients */ for (i = 0; nfds > 0 && i < MAXCONNECTIONS; i++) { if ((connections[i].flag & CONNECTED) && FD_ISSET(i, &ready)) { handle_tcp_request(&connection[i]); nfds--; } } do_something(); /* this routine needs to be called fairly often */ } ] We'll also need an ethernet-card. Any recommendations or warnings of what to avoid? Thanks for your help, Svante.Lindahl@front.se (!-net: ...!uunet!front.se!svante) (non-mx: Svante.Lindahl%front.se@uunet.uu.net)
zap@front.se (Svante Lindahl) (06/05/89)
Before anybody flames me for this error in my previous posting: > Does a NULL-pointer as the timeout parameter imply that the > descriptors are polled for pending IO? It shouldn't. A NULL-pointer means that select() should block indefinitely. What I meant to say was "does a pointer to zero-valued timeval structure mean that that the filedescriptors are polled for pending IO?". Svante