php man page for socket_write

Query: socket_write

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

SOCKET_WRITE(3) 							 1							   SOCKET_WRITE(3)

socket_write - Write to a socket

SYNOPSIS
int socket_write (resource $socket, string $buffer, [int $length])
DESCRIPTION
The function socket_write(3) writes to the $socket from the given $buffer.
PARAMETERS
o $socket - o $buffer - The buffer to be written. o $length - The optional parameter $length can specify an alternate length of bytes written to the socket. If this length is greater than the buffer length, it is silently truncated to the length of the buffer.
RETURN VALUES
Returns the number of bytes successfully written to the socket or FALSE on failure. The error code can be retrieved with socket_last_error(3). This code may be passed to socket_strerror(3) to get a textual explanation of the error. Note It is perfectly valid for socket_write(3) to return zero which means no bytes have been written. Be sure to use the === operator to check for FALSE in case of an error.
NOTES
Note socket_write(3) does not necessarily write all bytes from the given buffer. It's valid that, depending on the network buffers etc., only a certain amount of data, even one byte, is written though your buffer is greater. You have to watch out so you don't uninten- tionally forget to transmit the rest of your data.
SEE ALSO
socket_accept(3), socket_bind(3), socket_connect(3), socket_listen(3), socket_read(3), socket_strerror(3). PHP Documentation Group SOCKET_WRITE(3)
Related Man Pages
libssh2_sftp_readdir_ex(3) - debian
recv(2) - osf1
socket_recv(3) - php
socket_bind(3) - php
socket_recvfrom(3) - php
Similar Topics in the Unix Linux Community
length of data greater than 11
how to clear/clean mbufs (network buffer space)?
Strange character added when reading to buffer with length of 12
Write-Write on a socket
Length validation