How to organize the download of data via TCP?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Hello! Can you tell what I'm doing wrong.
There is a device which transmits data via com port! These data must be taken and transmitted to the WEB server for further processing and loading into the database.
Accept data and send to the server but on the server side, something goes wrong.
Opened on the web server(UBUNTU) port 10000 command
 iptables -A INPUT-i eth0 -p tcp —dport 10000-j ACCEPT

Turned off the firewall on the server.
On one of the pages application Yii2 put in code
$address = ''; $port = 10 000; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_connect($socket, $address, $port); socket_write($socket, "GET / HTTP/1.0\\\\"); $result = "; while($read = socket_read($socket, 1024)) { $result .= $read; } socket_close($socket); echo "the result: $result\\";

But it turns out error
PHP Warning – yii\\base\\ErrorException socket_connect(): unable to connect [111]: Connection refused

If I put port 80. there are no errors.
Can you explain those who are engaged in such problems, how to organize?
by | 9 views

1 Answer

0 like 0 dislike
Look at the socket_listen function.

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
35,596 users