当前位置:Gxlcms > PHP教程 > PHPsocket实现和Java端readFully对接

PHPsocket实现和Java端readFully对接

时间:2021-07-01 10:21:17 帮助过:4人阅读

java:

DataInputStream stream = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
int i=  stream.readInt();
byte[] b = newbyte[i];
stream.readFully(b);
System.out.println(new String(b));

php:

functionwriteInt($socket, $i)
{$data = pack('N', $i); 
    socket_write($socket, $data);
}
writeInt($sock,strlen("ZXCV"));
socket_write($sock,"ZXCV",strlen("ZXCV"));

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了PHP socket实现和Java端readFully对接,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 人气教程排行