Problem with sending 0xFF with server.write()

Hi, I'm running a Telnet server on an Arduino Ethernet but am having trouble sending 0xFF using server.write .

server.write((byte)0x00); works fine
server.write((byte)0xFF); DOESN'T work
server.write((byte)0x0D); //CR works fine

I'm using Realterm at the PC end as the telnet client.

Any ideas?

Martin.

0xFF is a special character in the Telnet protocol. It's called "IAC", or "Interpret As Command" and is used to start a command sequence. The character will be getting through, but your client may be interpreting it specially.

Try sending it twice (0xFF,0xFF). This is the normal way of "escaping" the IAC command so it gets through. Your terminal should then treat it as one 0xFF.

Ah! Thanks I wondered if it might be some weirdness like that. Strange that Realterm doesn't display it (or at least give you the option of how to handle it) as it's pretty good in all other respects.

Martin.

It's pretty good that it does it the way it does because it's a telnet program. It's also interpreting some escape sequences and the like. If you transfer binary data, don't use a telnet client, write your own client if it's not a standard protocol.