Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PTelnetSocket::SendSubOption ( BYTE  code,
const BYTE *  info,
PINDEX  len,
int  subCode = -1 
)

Send a sub-option with the information given.

Returns:
TRUE if the command was successfully sent.
Parameters:
codeSuboptions option code.
infoInformation to send.
lenLength of information.
subCodeSuboptions sub-code, -1 indicates no sub-code.

Definition at line 486 of file telnet.cxx.

References IAC, SB, SE, and Write().

Referenced by OnDo(), OnSubOption(), and SetWindowSize().

{
  if (!StartSend("SendSubOption", code))
    return FALSE;

  PDebugError << "with " << len << " bytes." << endl;

  PBYTEArray buffer(len + 6);
  buffer[0] = IAC;
  buffer[1] = SB;
  buffer[2] = code;
  PINDEX i = 3;
  if (subCode >= 0)
    buffer[i++] = (BYTE)subCode;
  while (len-- > 0) {
    if (*info == IAC)
      buffer[i++] = IAC;
    buffer[i++] = *info++;
  }
  buffer[i++] = IAC;
  buffer[i++] = SE;

  return PTCPSocket::Write((const BYTE *)buffer, i);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index