title: using expect to send a single byte
body: <p>Have a tcl expect connection to a telnetd and want to send the telnet BREAK.
  There for the telnetd must be informend to go into command mode. So the IAC (255) hast to be sende.
  After this BRK(243) has to be send.
  I verifyed this with a putty->telnetd connection. Putty can send "BREAK". The network traffic shows what is expected 255/243</p>
  
  <p>When I send ICA(255)/BRK(243) with tcl expect I see in the network traffic, that three bytes (255/255/243) were  send.</p>
  
  <p>I found out when I send i.e. 254 I see one byte
  When I send 255. It is two bytes.
  I expect 255, which is -1 or ff has someting special in expect. </p>
  
  <p>How can I achive to get just 255 onto the wire?</p>
  
  <p><code>fconfigure  $channel  -translation 
   exp_send -i $channel --  [binary format H4 FFF3]</code></p>
  
  <p>This sends "ff ff f3" to the telnetd</p>
  
  <p>As mention in the responce, yes, the language has to be taken into account. So I add fconfigure to have none</p>
  
  <p>Here is my code:
  <code>package require Expect
  spawn telnet localhost
  fconfigure $spawn_id -translation binary
  exp_send "[binary format H4 FFf3]"
  after 2000</code></p>
  
  <p>When I look on the wire with <code>tcpdump -X -i localhost port 23</code> I see <strong>FFFFF3</strong>.</p>
  
  <p><code>11:26:10.358187 IP localhost.44802 &gt; localhost.telnet: Flags [P.], seq 129:132, ack 148, win 342, options [nop,nop,TS val 1826173122 ecr 1826168178], length 3
          0x0000:  4510 0037 835b 4000 4006 b953 7f00 0001  E..7.[@.@..S....
          0x0010:  7f00 0001 af02 0017 b004 9eec f815 49e3  ..............I.
          0x0020:  8018 0156 fe2b 0000 0101 080a 6cd9 30c2  ...V.+......l.0.
          0x0030:  6cd9 1d72 ffff f3
  </code></p>
  
  <p>I look into telnet with strace and see:
  <code>203 27482 12:37:28 read(0, "\377\363", 8192) = 2
  204 27482 12:37:28 select(4, [0 3], [3], [3], {0, 0}) = 1 (out [3], left {0, 0})
  205 27482 12:37:28 sendto(3, "\377\377\363", 3, 0, NULL, 0) = 3
  </code>
  fff3 is received by expect, ff ff f3 is send to the telnetd.</p>