Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- # zmienne predefiniowane -------------------------------------------
- $host = "127.0.0.1";
- $port = 12345;
- # tworzymy gniazdo od razu podlaczone do serwera -------------------
- if( ! ( $client = stream_socket_client( "tcp://$host:$port", $errno, $errstr, 5 ) ) ){
- print "stream_socket_client(): $errstr\n";
- exit(1);
- }
- # odczytujemy wiadomosc z serwera ----------------------------------
- $msg = "";
- while( ! feof($client) ){
- $msg .= fgets( $client, 1024 );
- }
- # zamykamy gniazdo -------------------------------------------------
- fclose($client);
- # wyswietlamy wiadomosc --------------------------------------------
- print "$msg\n";
- #-------------------------------------------------------------------
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement