Skip to main content

parse_aux_port

Function parse_aux_port 

Source
pub fn parse_aux_port(data: &[u8]) -> Result<u16, FbError>
Expand description

Extract the port of the auxiliary channel from the WireOp::ConnectRequest response data, which holds a raw sockaddr of the server.

Only the port is used: the address the server reports is the one it sees locally, which is wrong as soon as it sits behind a NAT, so the reference client reuses the address of the main connection instead. This is what aux_connect does in the firebird sources. The port lives at offset 2 in network byte order for both sockaddr_in and sockaddr_in6, whatever the sockaddr layout of the server.