Question

In a PHP script I am writing, I need to send a control+z character down a network socket I have previously created. I understand the ctrl+z character to be chr(26), so at the end of the string I am sending I have added a new line (\r\n) and then the chr(26) as follows:

$socket=fsockopen($host['host'],$host['port']);
fputs($socket, "I am a message\r\n" . chr(26));
fclose($socket);

Sadly, this isn't sending a Ctrl+Z, as I'd hoped it would.

Regards,

Jon

Was it helpful?

Solution

It is probably being sent just fine. Add extra text after the ^Z to confirm.

The question is what do you want it to do when it gets there? Does the program you're communicating with handle a ^Z character how you'd expect it to?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top