[gambit-list] output ports created with ##open-predefined not being garbage collected

Marc Feeley feeley at iro.umontreal.ca
Sat Apr 11 14:54:31 EDT 2020


> On Apr 11, 2020, at 2:16 PM, Jörg F. Wittenberger <Joerg.Wittenberger at softeyes.net> wrote:
> 
> On Sat, 11 Apr 2020 13:08:23 -0400
> Marc Feeley <feeley at iro.umontreal.ca> wrote:
> 
>>> On Apr 11, 2020, at 1:01 PM, Jörg F. Wittenberger
>>> <Joerg.Wittenberger at softeyes.net> wrote:
>> ...
>> Are you communicating with UDP?  If that is the case then maybe you
>> can use Gambit’s UDP ports directly:
> 
> No, it's abstract unix domain sockets in the case at hand.
> 
> But I'm more interested to learn how to get the low level things
> straight in principle.
> 
>> (open-udp port-number-or-address-or-settings)
> 
> At another currently questionable code spot (after all, may code fails
> currenlty with confused malloc in short order:-/ ) I actually tried to
> used gambit's UDP.
> 
> But I failed to find out how to bind the outgoing port to the one I'm
> listening on for the reply.  So I went back to use gamsock again.
> 
> /Jörg
> 
>> This procedure opens a socket for doing network communication with
>> the UDP protocol. The default value of the direction: setting is
>> input-output, i.e. the Scheme program can send information and
>> receive information on the socket. The sending direction can be
>> closed using the close-output-port procedure and the receiving
>> direction can be closed using the close-input-port procedure. The
>> close-port procedure closes both directions.
>> 
>> The resulting port designates a UDP socket. Each call to read and
>> udp-read-subu8vector causes the reception of a single datagram on the
>> designated UDP socket, and each call to write and
>> udp-write-subu8vector sends a single datagram. UDP ports are a direct
>> subtype of object-ports (i.e. they are not character-ports) and read
>> and write transfer u8vectors. If read is called and a timeout occurs
>> before a datagram is transferred and the timeout thunk returns #f
>> (see the procedure input-port-timeout-set!) then the end-of-file
>> object is returned.
> 
> Just re-read this.  Still no clue.

Maybe you should read that section of the Gambit manual which has examples, such as:

> (define p (open-udp (list local-address: "*" address: "time.nist.gov:37")))
> (write '#u8() p)
> (read p)
#u8(222 27 158 226)

Marc





More information about the Gambit-list mailing list