Nonsense code or not, it works now and I've logged thousands of bytes without error.
Removing the unpack() line and adjusting for variable names, I'm back where I was before I showed up here.
The nonsense code I have came from PHP.net Jacques1 Show us, please. How would a guru such as yourself, unpack that binary data? You give comments and criticism freely. can you even do it? Again, what IDE are the cool kids here using?