作者:sEn_森森森森森 | 来源:互联网 | 2017-05-13 02:18
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教程有兴趣的朋友有所帮助。