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(2000)    # Listens on localhost:2000 (IPv4)
TcpServer(active)

julia> server = listen(ip"::1",2000)     # Listens on localhost:2000 (IPv6)
TCPServer(active)

julia> server = listen(IPv4(0),2001)     # Listens on port 2001 on all IPv4 interfaces
TCPServer(active)

julia> listen("testsocket")     # Listens on a domain socket/named pipe
PipeServer(active)

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.

*Required Field
Details

Checking you are not a robot: