Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
SocketAddress
cajeta.io.net.SocketAddress — an immutable socket address: an
IpAddress paired with a TCP/UDP port (0..65535). parse
accepts the two canonical host:port spellings — "127.0.0.1:8080" for IPv4
and "[::1]:8080" for IPv6 (bracketed literal) — and toString reproduces
exactly that form, so parse(s).toString() round-trips byte-identically. A
bare host with no :port is not accepted by parse; use of to build one
programmatically.
SocketAddress addr #= SocketAddress.parse("127.0.0.1:8080");
int32 port = addr.getPort(); // 8080
IpAddress lo #= IpAddress.loopbackV6();
SocketAddress v6 #= SocketAddress.of(#lo, 443);
String text #= v6.toString(); // "[::1]:443"
Methods
| Signature | |
|---|---|
SocketAddress() | The IPv4 wildcard 0.0.0.0:0 |
static #SocketAddress of(#IpAddress addr, int32 port) ⚑ | Build from an existing IpAddress (ownership moves in) and a port |
IpAddress getIp() | The IP endpoint |
int32 getPort() | The port (0..65535) |
AddressFamily getFamily() | The address family of the contained IP (V4 or V6) |
boolean equals(SocketAddress other) | Equal iff IPs and ports match |
static #SocketAddress parse(String input) ⚑ | Parse "ip:port" / "[v6]:port" text |
#String toString() | Canonical text: ip:port for IPv4, [ip]:port for IPv6 — the exact inverse of parse |
⚑ = @EntryPoint
See also
- Tour: NetDemo
- Source:
runtime/src/cajeta/io/net/SocketAddress.cajeta - IpAddress — the address half; TcpListener / TcpStream / UdpSocket — where addresses are used