InterviewSolution
| 1. |
How Can I Read Only One Character At A Time? |
|
Answer» This question is usually asked by people who are testing their server with telnet, and want it to process their keystrokes ONE character at a time. The correct technique is to use a psuedo terminal (pty). More on that in a minute. You can have your server send a sequence of control characters: 0xff 0xfb 0x01 0xff 0xfb 0x03 0xff 0xfd 0x0f3, which translates to IAC WILL ECHO IAC WILL SUPPRESS-GO-AHEAD IAC DO SUPPRESS-GO-AHEAD. For more information on what this means, check out std8, std28 and std29. Roger also gave the following tips:
Use of a pty would also be the correct way to EXECUTE a child process and pass the i/o to a socket. This question is usually asked by people who are testing their server with telnet, and want it to process their keystrokes one character at a time. The correct technique is to use a psuedo terminal (pty). More on that in a minute. You can have your server send a sequence of control characters: 0xff 0xfb 0x01 0xff 0xfb 0x03 0xff 0xfd 0x0f3, which translates to IAC WILL ECHO IAC WILL SUPPRESS-GO-AHEAD IAC DO SUPPRESS-GO-AHEAD. For more information on what this means, check out std8, std28 and std29. Roger also gave the following tips: Use of a pty would also be the correct way to execute a child process and pass the i/o to a socket. |
|