pack packaging code pack ("L3", 123456789 (fixed value), strlen (message content), 1 (0 or 1)).) Message content;
the overall effect is (fixed code + content length + whether encrypted) binary conversion of these three fields as a packet header and then connect the specific message content
such as pack ("L3codes, 123456789,200,0). "i am the test"; where 200 is a character length so it is a variable value
in fact, there is no problem for client c-sharp to unpack. They intercept the header and unpack it at a fixed length. When unpacking, everything is normal
. I want to use PHP to simulate the client to receive socket messages and unpack them. When I encounter problems, I unpack them with unpack ("L3clients, $output);). Obviously, this will not work, because this result can only solve the three fields of Baotou, and the content of the message connected behind it is gone, but I don"t want to intercept the string to unpack it, which seems to be very troublesome. It seems that there is a way to solve all fields directly with unpack, including the content that does not carry out binary conversion, but I have forgotten how to write it in L3 in unpack. Unpack ("how to write here can solve the whole content directly", $output); This is feasible. What I hate is that I can"t remember how to write it.
doesn"t want to make a hard turn in any other way, so I want to take advantage of this corner, because the result is not important, I just want this usage, just use unpack to solve all the content, how to do it, which god comes to give me some advice