Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

socket_send(3) [php man page]

SOCKET_SEND(3)								 1							    SOCKET_SEND(3)

socket_send - Sends data to a connected socket

SYNOPSIS
int socket_send (resource $socket, string $buf, int $len, int $flags) DESCRIPTION
The function socket_send(3) sends $len bytes to the socket $socket from $buf. PARAMETERS
o $socket - A valid socket resource created with socket_create(3) or socket_accept(3). o $buf - A buffer containing the data that will be sent to the remote host. o $len - The number of bytes that will be sent to the remote host from $buf. o $flags - The value of $flags can be any combination of the following flags, joined with the binary OR ( |) operator. Possible values for $flags +--------------+---------------------------------------------------+ | | | | MSG_OOB | | | | | | | Send OOB (out-of-band) data. | | | | | | | | MSG_EOR | | | | | | | Indicate a record mark. The sent data completes | | | the record. | | | | | | | | MSG_EOF | | | | | | | Close the sender side of the socket and include | | | an appropriate notification of this at the end of | | | the sent data. The sent data completes the trans- | | | action. | | | | | | | |MSG_DONTROUTE | | | | | | | Bypass routing, use direct interface. | | | | +--------------+---------------------------------------------------+ RETURN VALUES
socket_send(3) returns the number of bytes sent, or FALSE on error. SEE ALSO
socket_sendto(3). PHP Documentation Group SOCKET_SEND(3)

Check Out this Related Man Page

SOCKET_READ(3)								 1							    SOCKET_READ(3)

socket_read - Reads a maximum of length bytes from a socket

SYNOPSIS
string socket_read (resource $socket, int $length, [int $type = PHP_BINARY_READ]) DESCRIPTION
The function socket_read(3) reads from the socket resource $socket created by the socket_create(3) or socket_accept(3) functions. PARAMETERS
o $socket - A valid socket resource created with socket_create(3) or socket_accept(3). o $length - The maximum number of bytes read is specified by the $length parameter. Otherwise you can use , , or to end reading (depending on the $type parameter, see below). o $type - Optional $type parameter is a named constant: o PHP_BINARY_READ (Default) - use the system recv() function. Safe for reading binary data. o PHP_NORMAL_READ - reading stops at or . RETURN VALUES
socket_read(3) returns the data as a string on success, or FALSE on error (including if the remote host has closed the connection). The error code can be retrieved with socket_last_error(3). This code may be passed to socket_strerror(3) to get a textual representation of the error. Note socket_read(3) returns a zero length string ("") when there is no more data to read. SEE ALSO
socket_accept(3), socket_bind(3), socket_connect(3), socket_listen(3), socket_last_error(3), socket_strerror(3), socket_write(3). PHP Documentation Group SOCKET_READ(3)
Man Page

4 More Discussions You Might Find Interesting

1. Programming

Store file into a buffer to send it through a socket

Hello, I'm doing a very simple program which reads a file and sends whatever is in the file through a socket. Like the program "file2cable". Let's say i have a file containing the following, which is a hex dump of an ARP request frame: ff ff ff ff ff ff 00 1b 24 79 5a 73 08 06 00 01 08... (5 Replies)
Discussion started by: semash!
5 Replies

2. Programming

Write-Write on a socket

Can anyone tell what happens if each end writes at the same time on the same socket ? - if one of them issues a read() after write() has completed, will it record into the buffer what the other sent ? ex. e1 writes to e2 - - - while - - - e2 writes to e1 (at the same time) e1 read () - what... (1 Reply)
Discussion started by: gendaox
1 Replies

3. Red Hat

Xinetd flags and tcp46 socket usage to telnet / ssh via v4 and v6 addresses

Hello everyone.. I need some help in understanding the usage of tcp46 socket and xinetd.d flags.. What I'm trying to do? I'm looking to use tenet via tcp46 socket for both ipv4 and ipv6 traffic. For this, if i set flags = IPV6 xinetd.d, telnet service, i can not telnet via V4. If I unset the... (0 Replies)
Discussion started by: Sudharshan
0 Replies

4. Shell Programming and Scripting

Extract sequences of bytes from binary for differents blocks

Hello to all, I would like to search sequences of bytes inside big binary file. The bin file contains blocks of information, each block begins is estructured as follow: 1- Each block begins with the hex 32 (1 byte) and ends with FF. After the FF of the last block, it follows 33. 2- Next... (59 Replies)
Discussion started by: Ophiuchus
59 Replies