در ضمن دستگاه را هم روی یک سرور چینی اما با ASP تست کردیم و دستگاه هیچ مشکلی نداشت.
/* @author Arman Abl @copyright 2015 */ignore_user_abort();set_time_limit(0);// set some variables$host = "xxx.xxx.xxx.xxx";$port = 8888;// create socket$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");// bind socket to port$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");// start listening for connections$result = socket_listen($socket) or die("Could not set up socket listener\n");while(true){ // accept incoming connections // spawn another socket to handle communication $spawn = socket_accept($socket); if(!$spawn){ continue; } // read client input $input = socket_read($spawn, 335544 ); if(!$input){ continue; } // clean up input string $input = trim($input);
$load = file_get_contents('test.txt'); file_put_contents('./test.txt',$load."[".date("d M Y G:i:s" , time())."]Message : ".$input."\n"); //$output = "ok"; //socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n");}// close socketssocket_close($spawn);socket_close($socket);