Changeset 412


Ignore:
Timestamp:
Aug 16, 2012, 10:46:01 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Telnet Com Port option now working without telnet option negotiation.
Location:
PinConnection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/UCommTelnet.pas

    r411 r412  
    8585    PortType: TTelnetPortType;
    8686    ErrorCount: Integer;
     87    OptionsNegotationEnable: Boolean;
    8788    procedure Register(Option: TTelnetOption);
    8889    procedure Unregister(Option: TTelnetOption);
     
    147148  I: Integer;
    148149begin
    149   CheckOption;
     150  if Telnet.OptionsNegotationEnable then CheckOption;
    150151  try
    151152    RequestData := TBinarySerializer.Create;
     
    158159    RequestData.WriteByte(Byte(Code));
    159160    RequestData.WriteList(Request, 0, Request.Count);
    160     Telnet.SendCommand(tcSB, RequestData.List, ResponseData.List);
    161     if ResponseData.List[0] <> Byte(Code) then
    162       raise Exception.Create(SWrongResponseOption);
    163     ResponseData.List.Delete(0);
    164     Response.Assign(ResponseData.List);
     161    if Assigned(Response) then begin
     162      Telnet.SendCommand(tcSB, RequestData.List, ResponseData.List);
     163      if ResponseData.List[0] <> Byte(Code) then
     164        raise Exception.Create(SWrongResponseOption);
     165      ResponseData.List.Delete(0);
     166      Response.Assign(ResponseData.List);
     167    end else Telnet.SendCommand(tcSB, RequestData.List, nil);
    165168  finally
    166169    RequestData.Free;
    167     RequestData.Free;
     170    ResponseData.Free;
    168171  end;
    169172end;
     
    201204  FActive := AValue;
    202205  for I := 0 to Options.Count - 1 do
    203     TTelnetOption(Options[I]).Active := AValue;
     206  with TTelnetOption(Options[I]) do begin
     207    if (not ServerChecked) and OptionsNegotationEnable then CheckOption;
     208    Active := AValue;
     209  end;
    204210end;
    205211
     
    224230      end else
    225231      if FState = tsIAC then begin
     232        if Data = Byte(tcIAC) then begin
     233          RawData.WriteByte(Data);
     234          FState := tsNormal;
     235        end else
    226236        if Data = Byte(tcSB) then begin
    227237          // Subnegotation
  • PinConnection/UCommTelnetComPortOption.pas

    r411 r412  
    8888begin
    8989  inherited;
    90   //SetBaudRate(FBaudRate);
    91   //SetDTR(FDTR);
    92   //SetRTS(FRTS);
     90  if AValue then begin
     91    SetBaudRate(FBaudRate);
     92    SetDTR(FDTR);
     93    SetRTS(FRTS);
     94  end;
    9395end;
    9496
     
    101103  try
    102104    Request := TBinarySerializer.Create;
     105    Request.Endianness := enBig;
    103106    Request.List := TListByte.Create;
    104107    Request.OwnsList := True;
     
    121124    Request.List := TListByte.Create;
    122125    Request.OwnsList := True;
     126    Request.Endianness := enBig;
    123127    Response := TBinarySerializer.Create;
    124128    Response.List := TListByte.Create;
    125129    Response.OwnsList := True;
     130    Response.Endianness := enBig;
    126131    Request.WriteByte(Byte(cpcSetBaudRate));
    127132    Request.WriteCardinal(0);
Note: See TracChangeset for help on using the changeset viewer.