wheeler@JULIET.MITRE.ORG (Brien L. Wheeler) (03/19/91)
Robyne, In response to: > Hi, Hi. > I am using the TNetListen and TNetAccept commands to establish > a server connection. My problem is I need to get the listen socket > number after performing the TNetListen call. From what I can see, all of > the "listen" related data structures and routines that access them are > static to the file tsaplisten.c. > Is there a way to get this socket number? Any help would be > appreciated. Please email any responses. Sure, but it is an ugly hack. Basically, you : /* Open /dev/null to find out what the next available file desc is */ fd = open("/dev/null", O_RDWR); if (fd == -1) adios("Can't open /dev/null ?!?!?"); /* Close down file desc so it will be assigned in TNetListen */ close(fd); /* Perform TNetListen. Socket allocated will be given the same file desc just closed down */ if (TNetListen(ta, td) == NOTOK) adios("Can't listen on OSI address"); /* fd contains the file descriptor of the socket opened for OSI listen. */ As I said, it is ugly, but it does work. > Thanks in Advance No problem. Brien BTW, what are you trying to do with ISODE? -- Brien L. Wheeler Member of Technical Staff The MITRE Corporation wheeler@mbunix.mitre.org