listen(addr,port)
listen([addr,]port) -> TCPServer
Listen on port on the address specified by addr. By default this listens on localhost only. To listen on all interfaces pass IPv4(0) or IPv6(0) as appropriate.
Examples
julia> server = listen("my_pipe.sock")
PipeServer(DomainSocket("my_pipe.sock"))
julia> server isa PipeServer
true
This example creates and listens on a named pipe or domain socket with the specified path "my_pipe.sock". It returns a PipeServer object, which represents the server endpoint of the named pipe or domain socket. The isa operator is used to verify that the returned object is an instance of PipeServer.
Common mistake example:
julia> server = listen("/tmp/my_pipe.sock")
ERROR: ArgumentError: Invalid path: /tmp/my_pipe.sock
In this example, an invalid path is provided, leading to an ArgumentError. Ensure that the path provided is valid and accessible.
See Also
accept, bind, :@spawn, connect, fetch, getaddrinfo, gethostname, getipaddr, getsockname, init_worker, IPv4, IPv6, isready, issocket, kill, listen, recv, recvfrom, remotecall, remotecall_fetch, remotecall_wait, RemoteRef, send, setopt,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.