A socket connection can be created in php using the code snippet below.
This code snippet also shows how to write into a socket and read from a socket using php.
.......
.......
$SERVER_IP = 'x.x.x.x';
$SERVER_PORT = 'yy';
$Server = socket_create(AF_INET, $SOCK_STREAM, $SOL_TCP);
if($ServerConnected = @socket_connect($Server, $SERVER_IP, $SERVER_PORT))
{
@socket_write($Server , 'hello');
@socket_read($Server , 256);
........
}
.......
.......
No comments:
Post a Comment