PHP » GoLang |
login |
register |
about
|
GoLang stream_socket_client
request it (496)
GoLang replacement for PHP's stream_socket_client
[edit | history]
stream_socket_client(PHP 5, PHP 7) stream_socket_client — Open Internet or Unix domain socket connection Description
resource stream_socket_client
( string
$remote_socket
[, int &$errno
[, string &$errstr
[, float $timeout = ini_get("default_socket_timeout")
[, int $flags = STREAM_CLIENT_CONNECT
[, resource $context
]]]]] )
Initiates a stream or datagram connection to the destination specified
by
Parameters
Return Values
On success a stream resource is returned which may
be used together with the other file functions (such as
fgets(), fgetss(),
fwrite(), fclose(), and
feof()), Errors/Exceptions
On failure the Examples
Example #1 stream_socket_client() example
<?php Example #2 Using UDP connection Retrieving the day and time from the UDP service "daytime" (port 13) on localhost.
<?php NotesWarning
UDP sockets will sometimes appear to have opened without an error, even if the remote host is unreachable. The error will only become apparent when you read or write data to/from the socket. The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data.
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|