TCP server ports

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

TCP server ports

Peter-2
Hello!

Is there a kawa-specific way to open a server tcp port, listen for
clients, and get back a normal Scheme I/O port when someone connects?

Thanks for any help with this!
Greetings, Peter
Reply | Threaded
Open this post in threaded view
|

Re: TCP server ports

Per Bothner
On 09/14/2017 02:28 AM, Peter wrote:
> Hello!
>
> Is there a kawa-specific way to open a server tcp port, listen for
> clients, and get back a normal Scheme I/O port when someone connects?
>
> Thanks for any help with this!

Not that I know of.  But you can use standard Java class and methods
directly in Kawa-Scheme.

   (define socket (listen-for-socket)) ; make your own listen-for-socket
   (define inp (gnu.kawa.io.InPort (socket:getInputStream)))

BTW if you write
     socket:input-stream
Kawa will automatically treat it like
      (socket:getInputStream)
--
        --Per Bothner
[hidden email]   http://per.bothner.com/