您好,欢迎访问一九零五行业门户网

PHP socket实现 readInt 和 readString 以及和Java端对接

java:
dataoutputstream out = new dataoutputstream(new bufferedoutputstream(socket.getoutputstream()));out.writeint(rewqty.getbytes().length);out.write(rewqty.getbytes());out.close();//php端是阻塞的,除非close
php:
functionreadint($sock){$buf = socket_read($sock,4); if ($buf){ return unpack('n',$buf)[1]; }else{ thrownewexception(); }}functionreadstring($socket) {$n = readint($socket); return socket_read($socket, $n);}echo readstring($sock,$l);echo\n;
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了php socket实现 readint 和 readstring 以及和java端对接,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息