Autor | Zpráva | ||
---|---|---|---|
Nickname Profil * |
#1 · Zasláno: 25. 5. 2012, 13:34:24
Dobrý deň,
Mám taký problém, v PHP si chcem vytvoriť web server socket s tým, že bude komunikovať s klientom. (Posielať mu dáta, Prijímať od neho dáta...) Čo sa týka spojenia, to sa nadviaže, s handshakingom problém nemám rovnako tak viem od klienta dáta dostať. Problém však nastáva pri odosielaní správy zo servera... vo wiresharku vidím, že niečo posielam klient to však zahodí :/ Zrejme sa v mojom kóde niečo vymyká štandardu... public function send($client, $msg){ $this->log(">before decode ".$msg); $len = $data = $decoded = $index = null; $len = $msg[1] & 127; if ($len === 126) { $this->masks = substr($msg, 4, 4); $data = substr($msg, 8); $this->initFrame = substr($msg, 0, 4); } else if ($len === 127) { $this->masks = substr($msg, 10, 4); $data = substr($msg, 14); $this->initFrame = substr($msg, 0, 10); } else { $this->masks = substr($msg, 2, 4); $data = substr($msg, 6); $this->initFrame = substr($msg, 0, 2); } for ($index = 0; $index < strlen($data); $index++) { $decoded .= $data[$index] ^ $this->masks[$index % 4]; } $this->log(">after decode ".$decoded); socket_write($client, $decoded, strlen($decoded)); Ak mi budete vedieť pomôcť, budem Vám veľmi vďačný |
||
Časová prodleva: 12 let
|
0