Loading ...
Sorry, an error occurred while loading the content.

Re: Sockets?

Expand Messages
  • Pavlos Stamboulides
    ... xrisimopoiei ... einai ... (mias kai ... XML-RPC ... tropo), o ... fsockopen ... Agapite Maki, den exw asxoli8ei me sockets. Omws, an trexeis ton server
    Message 1 of 2 , Aug 9, 2006
    • 0 Attachment
      --- In php_greek@yahoogroups.com, "Makhs Marimphs" <makhsm@...> wrote:
      >
      > Yia xara. Exw kapoio provlima me mia class pou exw ftiaksei poy
      xrisimopoiei
      > sockets.
      > (den parathetw tin klash mias kai apla xrisimopoiei ta sockets, den
      einai
      > kapoia abstract class apokleistika
      > yia sockets).
      >
      > Anoigw to socket kanonika:
      > $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
      >
      > kanw kai to connection me ton server...
      > $conn = socket_connect($socket, gethostbyname($hostname), $port);
      >
      > kai to specification tou server einai tetoio pou leei oti me to pou
      > sindeomai mou stelnei
      > ena message, kai to diavazw ws eksis:
      > while( $read = socket_read($socket, 1024) )
      > $server_reply .= $read;
      >
      > stelnw meta kapoia dedomena ta opoio apoteloun meros kapoiou query
      (mias kai
      > o
      > server ulopoiei kapoia xaraktiristika pou thimizoun SOAP h WSDL h
      XML-RPC
      > ktl
      > alla polu vasika pramata :P)
      >
      > ta erwtimata mou einai ta ekshs:
      > 1) den xerw ean stelnw ta dedomena mou swsta, xrhsimopoiw thn ekshs
      entoli:
      > if( socket_write($socket, $prep_query, strlen($prep_query) ) {
      > ...
      > ...
      > [ fenetai na trexei swsta mias kai den paraponietai h php :P ]
      > 2) afou steilw (efoson stelnontai ortha ta dedomena kai me swsto
      tropo), o
      > server mou
      > stelnei ena reply... kai ta diavazw me ton ekshs tropo:
      > while( $read = socket_read($this->socket, 1024, PHP_BINARY_READ) )
      > $reply .= $read;
      >
      > to provlima einai oti den diavazei tipota apolutws...
      > epsaksa na dokimasw kai to socket_recv alla den mporesa na vgalw akri
      > afou to teleutaio argument (to flag) stin function me exei mperdepsei
      > (dokimasa
      > merikes times (apo to manual) alla den douleuei).
      >
      > isws prepei na valw to socket se noblocking?
      > skeftomai na dokimasw anti yia sockets pio genikes functions opws
      fsockopen
      > ktl ktl..
      >
      > mporei kapoios na voithisei sto ti kanw lathos h na proteinei kati na
      > dokimasw?
      >
      >
      > Euxaristw.
      >
      > --
      > Μαριμπής Μάκης
      >

      Agapite Maki,

      den exw asxoli8ei me sockets. Omws, an trexeis ton server ston
      ypologisti sou, estw kai dokimastika, dokimase na trekseis kai to
      SmartSniff.

      Prokeitai gia ena programma pou parakolou8ei ka8e ti pou feygei kai
      erxetai apo tin karta diktyou sou. Etsi 8a mporeseis na deis ti feygei
      kai ti erxetai kai analoga 8a prakseis.

      Mou exei swsei apeires wres, otan to reply den fainotan ston browser
      giati to epairne kapoio allo programma, p.x. flash.

      Kalo kalokairi,
      Pavlos
    Your message has been successfully submitted and would be delivered to recipients shortly.