[comp.protocols.tcp-ip] programming question

icarus@End.Tufts.EDU ("Michael J. Saletnik - Local Unix Wizard's Apprentice") (10/31/90)

Hi.  I've got a question for all the experienced TCP/IP programmers out there.
I've been trying to find this in the manuals, but I can't anywhere.
I'd greatly appreciate confirmation of my technique and answers to the
random questions..
In any case:
System: Sun 3/50,3/180
OS: SunOS 4.1

Given a bound and listening socket, can I use
	fcntl(socket, F_SETFL, FNDELAY);
to cause it to be non-blocking, and that way when
I call accept() I'll either get back a new socket
for a new connection, or errno = EWOULDBLOCK
And when do I make the fcntl() call?

Given a newly connected socket from an accept(),
do I use
	fcntl(socket, F_SETFL, FASYNC);
to enable SIGIO signals, and
	fcntl(socket, F_SETOWN, getpid());
to point those signals at my process, and
	signal(SIGIO, handler);
to establish my handler?  What order should these
be?

Finally, if my signal handler is declared
	handler(sig, code, scp, addr)
	int sig, code;
	struct sigcontext *scp;
	char *addr;
how can I find out which socket (or file descriptor)
caused that signal?

	Thanks in advance,
				Michael J. Saletnik
				icarus@end.tufts.edu

bmiller@CABELL.VCU.EDU (Bryan Miller) (04/19/91)

I have a problem that is driving me crazy...and was hoping someone
could help me.  Here is the story:

We have an old 3Com NCS-150 along with several CS/1's connected
to our Ethernet backbone.  Also connected to the backbone is a
Pyramid mini.  What we want to do is connect the printer port
on the NCS-150 to a port on the CS/1.  Then, a program running
on the Pyramid would be used to gather the log data from the
NCS-150 and store it in a file.....

Has anyone done anything like this, or something similar, maybe
with different equipment?  Any pointers, suggestions, or other
solutions would be greatly appreciated.

Thanks,

Bryan Miller