I’m using expect to respond to a network service. However, I’ve noticed in Wireshark, when I do the following:
send "mystring\r\n"
it gets translated on the wire to:
“mystring\n”
I’ve tried setting stty raw, and various combinations of \r, \n, as well as sending ASCII codes from within expect. Expect seems to be translating any of these combinations to \n. The problem is the server seems to require a \r\n in order to accept the input. I’ve been able to determine this, because when I use “interact” from within expect, and then type a ^M (control-v enter) from the shell, Wireshark sees a string of:
“mystring \r\n”
sent out over the wire, and the server processes the input correctly. Is there a way to properly send this combination through expect without the translation?
Are you doing the
sttydirectly or by usingset stty_init rawin theexpectscript? (expect‘ssttycommand operates on your terminal, not the pty.) You may also want to look at the-nottyinitoption tospawn.