I'm trying to send and receive data by PHP socket.
Evrything is OK but when I'm trying to send data PHP does not send anything (Wireshark told me that sent data length was 0).
I'm using this code:
<?php
$address = 'example.com';
$port = 1234;
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$sockconnect = socket_connect($sock, $address, $port);
$c = 0;
do {
$c++;
$msg = '<test>Xml data</test>';
socket_write($sock, $msg, strlen($msg));
echo socket_read($sock, 1024 * 100, PHP_NORMAL_READ);
} while ($c < 3);
socket_close($sock);
Can anyone help me? Thanks for reading my question.