Talk:Сериен порт

From Ilianko
Revision as of 16:31, 25 February 2013 by Anko (talk | contribs) (→‎php)

php

Инсталира се ser2net и се конфигурира ser2net.conf

После се достъпва като стандартен сокет

if(isset($_POST['message']))
{
  $fp =fsockopen("localhost", 2000);
  
  if( !$fp) {
    echo "Error";die();
  }
  fread($fp, 128);
  fwrite($fp, "$_POST[message]");
  $status = fread($fp, 128);
  fclose($fp);


}

?>
<html><head></head>
<body>
<form name="serial" action="" method="post">
Message:  <input name="message" type="text"><input type="submit" value="Send">

<?= (isset($status))? $status:'' ?>
</form>
</body>
</html>

C#