How do I send telnet option codes?
- by Matt
I've written a socket listener in Java that just sends some data to the client.
If I connect to the server using telnet, I want the server to send some telnet option codes. Do I just send these like normal messages?
Like, if I wanted the client to print "hello", I would do this:
PrintWriter out = new PrintWriter(clientSocket.getOutputStream());
out.print("hello");
out.flush();
But when I try to send option codes, the client just prints them. Eg, the IAC char (0xff) just gets printed as a strange y character when I do this:
PrintWriter out = new PrintWriter(clientSocket.getOutputStream());
out.print((char)0xff);
out.flush();