tcp - Sending string/data via php to device connected to my server -
good day,
i have hardware device (an rn-xv wifi chip) has connected server ip address through port 80. able send junk info , responds "server unable serve request", meaning there connection.
now, need talk device/send data/strings. know basic php, have no thought how approach problem. device connected server but:
to send info it, have know ip/port of device connected right? how find out?
if able obtain this..is sending info matter of opening tcp connection via php , sending string?
now connected server, somehow able send strings, returns server unable serve request. how send info particular php file read?
please help! in advance!
you must write programme socket .see page php socket programming http://php.net/manual/en/book.sockets.php
with function can connect every port , send info , response every format want .
sample:for connect device
<?php $fp = fsockopen("udp://127.0.0.1", 2000, $errno, $errstr); if (!$fp) { echo "error: $errno - $errstr<br />\n"; } else { fwrite($fp, "data send"); while ( !feof( $fp ) ) { $ret .= fgets( $fp, 4096 ); } echo $ret; fclose($fp); } ?> more sample http://php.net/manual/en/function.fsockopen.php
php tcp udp wifi arduino
No comments:
Post a Comment