reference appendices
Socket Transports
Socket transport names describe connection mechanisms available to stream socket functions. Common transports include TCP, UDP, Unix sockets, TLS, and SSL compatibility aliases.
Use This Reference When
- Reading a connection string such as
tcp://host:port. - Checking available transports with
stream_get_transports(). - Reviewing timeout and TLS requirements for network clients.
List Available Transports
PHP example
<?php
foreach (stream_get_transports() as $transport) {
echo $transport . PHP_EOL;
}
// Prints the transports enabled by this PHP build.
Prefer maintained client libraries for application protocols. Raw sockets require careful timeout, TLS, framing, retry, and error handling.
Practice
Inspect Runtime Support
Print the available socket transports and identify whether TCP and TLS support are present in the local runtime.
Show solution
Use stream_get_transports(). Runtime support varies by build, so the check belongs in deployment diagnostics when a transport is required.