Refusing options
Top  Previous  Next

The telnet server may request that an option be used by sending a DO OPTION (or WILL OPTION) command where OPTION is the option code for the requested option. The client may refuse the option by returning a WONT OPTION (or DONT OPTION) command.

To capture and refuse these options the TelnetListener#doOption and TelnetListener#willOption methods must be overloaded. To refuse these option requests the Telnet#sendDontOption and Telnet#sendWontOption methods are used respectively.

Example


// capture DO option commands from telnet server
public void doOption(DoOptionEvent event) {
  TelnetOption option = event.getOption();
  telnet.sendWontOption(option);
}


// capture WILL option commands from telnet server

public void willOption(WillOptionEvent event) {
  TelnetOption option = event.getOption();
  telnet.sendDontOption(option);
}