accept ( server -- client remote ) (original) (raw)
accept ( server -- client remote )
Networking » Connection-oriented networking
Prev: | ( addrspec encoding -- server ) |
---|
Inputs
server | a handle |
---|
Outputs
client | a bidirectional stream |
---|---|
remote | an address specifier |
Word description
Waits for a connection to a server socket created by , and outputs a bidirectional stream when the connection has been established. The encoding of this stream is the one that was passed to the server constructor.
Errors
Throws an error if the server socket is closed or otherwise is unavailable.
Definition
USING: accessors io.sockets.private io.streams.duplex kernel ;
: accept ( server -- client remote )
[ dup addr>> [ (accept) ] keep parse-sockaddr swap ]
[ encoding>> ] bi swap ;