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 = '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\\\\"); $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?