Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    socket socket e ancora socket :D

    salve
    intanto volevo sapere: è meglio usare le funzioni socket_* oppure fsockopen e file?

    ho letto qualche guida (anche di fabio su freephp) ma non ho ben capito come faccio, ad un certo testo ricevuto, inviarne un'altro

    insomma non c'ho capito niente

  2. #2
    ma xkè se dico socket nessuno mi risponde?

    Codice PHP:
    <?php
    $ip 
    '207.58.142.122';
    echo 
    "Connessione in corso su $ip ...   ";

    $fp fsockopen($ip'21'$errno$errstr5);
    if (!
    $fp) die("Errore! $errstr ($errno)\n");
    else {

    echo 
    "[CONNESSO]\n";


    while(!
    feof($fp)) {
      
    $line=@fgets($fp);
      echo 
    $line;
    }

    }

    echo 
    "test";
    ?>
    esce

    C:\test>php a.php
    Connessione in corso su 207.58.142.122 ... [CONNESSO]
    220---------- Welcome to Pure-FTPd [TLS] ----------
    220-You are user number 1 of 50 allowed.
    220-Local time is now 23:19. Server port: 21.
    220-This is a private system - No anonymous login
    220 You will be disconnected after 15 minutes of inactivity.

    non viene test.. non esce mai dal while.. ma perchè?

  3. #3
    non vuole uscire.
    maledetto.
    -.-

    Tentativo di connessione... OK.
    Lettura della risposta:

    220 ADAM2 FTP Server ready.

    e sta fermo, non va oltre
    questa volta ho usato socket_create, socket_connect e

    while ($out = socket_read($socket, 4096)) {
    echo $out;
    if (preg_match("/200/", $out)) {
    echo "ADAM ha risposto!";
    break;
    }
    }

    ma se ne strafrega, non esce dal while :master:

  4. #4

  5. #5

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.