Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

socket sendto function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php socket sendto () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 4 >= 4.1.0, PHP 5)

socket_sendto -- Sends a message to a socket, whether it is connected or not

Syntax

int socket_sendto ( resource socket, string buf, int len, int flags, string addr [, int port] )

The function socket_sendto() sends len bytes from buf through the socket socket to the port at the address addr

The value of flags can be one of the following:

Table 1. possible values for flags

0x1 Process OOB (out-of-band) data.
0x2 Peek at incoming message.
0x4 Bypass routing, use direct interface.
0x8 Data completes record.
0x100 Data completes transaction.

Example 1. socket_sendto() Example

<?php
    $sh
= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    if (
socket_bind($sh, '127.0.0.1', 4242)) {
        echo
"Socket bound correctly";
    }
    
$buf = 'Test Message';
    
$len = strlen($buf);
    if (
socket_sendto($sh, $buf, $len, 0x100, '192.168.0.2', 4242) !== false) {
        echo
"Message sent correctly";
    }
    
socket_close($sh);
?>

See also socket_send() and socket_sendmsg().

Php socket sendto Function syntax tag

socket sendto php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php socket sendto syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online