Функция stream_socket_client()

20.12.2007

resource stream_socket_client ( string remote_socket [, int &errno [, string &errstr [, float timeout [, int flags [, resource context]]]]] )
. The type of socket created

is determined by the transport specified using standard URL formatting:
. For Internet Domain sockets

(AF_INET) such as TCP and UDP, the
parameter should consist of

a hostname or IP address followed by a colon and a port number. For Unix

domain sockets, the
portion should point

to the socket file on the filesystem.

The optional
can be used to

set a timeout in seconds for the connect system call.
is a bitmask field which may be set to any

combination of connection flags. Currently the selection of connection

flags is limited to
STREAM_CLIENT_CONNECT (default),
STREAM_CLIENT_ASYNC_CONNECT STREAM_CLIENT_PERSISTENT .
stream_socket_client() returns a

stream resource which may

be used together with the other file functions (such as ,
,
,
, and
).
If the call fails, it will return
FALSE call. If the value returned in
FALSE , it is an indication that the error

occurred before the
call. This is

most likely due to a problem initializing the socket. Note that

the
arguments will always be passed by

reference.
Depending on the environment, the Unix domain or the optional

connect timeout may not be available. A list of available

transports can be retrieved using
.

See
for a list of built in transports.
The stream will by default be opened in blocking mode. You can

switch it to non-blocking mode by using
.
The example below shows how to retrieve the day and time

from the UDP service "daytime" (port 13) in your own machine.
See also ,
,
,
,
,
,
,
,
, and

the
.

google.com bobrdobr.ru del.icio.us technorati.com linkstore.ru news2.ru rumarkz.ru memori.ru moemesto.ru

Рубрики: Без рубрики |

Оставить комментарий

Заметьте: Включена проверка комментариев. Нет смысла повторно отправлять комментарий.