$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($socket, '127.0.0.1', 8080); socket_listen($socket); socket_getsockname($socket, $address, $port); echo "Listening on $address:$port";This code creates a TCP socket, binds it to `127.0.0.1:8080`, listens for incoming connections, and then uses `socket_getsockname` to retrieve the local address and port of the socket. The result is then printed to the console. In this example, the package library used would be the built-in PHP sockets library.