Answer the question
In order to leave comments, you need to log in
How to organize data loading via TCP?
Hello! Can you suggest what I'm doing wrong.
There is a device that transmits data on the com port! These data must be received and transferred to the WEB server for further processing and loading into the database.
I receive data and send it to the server, but something goes wrong on the server side. Opened port 10000
on the web server (UBUNTU) with the command
<b> iptables -A INPUT -i eth0 -p tcp —dport 10000 -j ACCEPT</b>
$address = '192.168.1.180';
$port = 10 000;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $address, $port);
socket_write($socket, "GET / HTTP/1.0\r\n\r\n");
$result = "";
while($read = socket_read($socket, 1024))
{
$result .= $read;
}
socket_close($socket);
echo "Полученный результат: $result\r\n";
PHP Warning – yii\base\ErrorException
socket_connect(): unable to connect [111]: Connection refused
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question