🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.iso.dev-environ
Article #522

Re: your mail

#522
From: Brien L. Wheeler
Date: Mon, 18 Mar 1991 22:48
47 lines
1832 bytes
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
Technical Details
Message-ID: <9103182348.AA01662@juliet.mitre.org.mitre.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!JULIET.MITRE.ORG!wheeler
References: <9103181729.AA14890@ocfmail.ocf.llnl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!JULIET.MITRE.ORG!wheeler
From: wheeler@JULIET.MITRE.ORG (Brien L. Wheeler)
Newsgroups: comp.protocols.iso.dev-environ
Subject: Re: your mail
Message-ID: <9103182348.AA01662@juliet.mitre.org.mitre.org>
Date: 18 Mar 91 22:48:08 GMT
References: <9103181729.AA14890@ocfmail.ocf.llnl.gov>
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: inet
Organization: The Internet
Lines: 47