NEW Product: LAN TCP/IP to RS485 Serial Converter

Spread the love

 

KMtronic LAN TCP/IP to RS485 Serial Converter

 

Sending “Hello” to RS485 via USB<>RS485 adapter

KMtronic LAN TCP/IP to RS485 Serial Converter
KMtronic LAN TCP/IP to RS485 Serial Converter: Sending “Hello” to RS485 via USB<>RS485 adapter

 

Receiving data using PuTTY Telnet connected to
IP:192.168.1.199
PORT:12345

KMtronic LAN TCP/IP to RS485 Serial Converter
KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using PuTTY Telnet

 

KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using TCP Client Server software
KMtronic LAN TCP/IP to RS485 Serial Converter: Receiving data using TCP Client Server software

 

PHP test file

<?php

error_reporting(E_ALL);

echo "<h2>TCP/IP Connection</h2>\n";

/* Get the port for the WWW service. */
$service_port = 12345;

/* Get the IP address for the target host. */
$address = '192.168.1.199';

/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
echo "OK.\n";
}

echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
} else {
echo "OK.\n";
}

$in = "Hello from PHP";
$out = '';

echo "Sending HTTP HEAD request...";
socket_write($socket, $in, strlen($in));
echo "OK.\n";

//echo "Reading response:\n\n";
//while ($out = socket_read($socket, 2048)) {
// echo $out;
//}

echo "Closing socket...";
socket_close($socket);
echo "OK.\n\n";

?>

 

 

 

145total visits,3visits today