Changeset 412
- Timestamp:
- Aug 16, 2012, 10:46:01 AM (12 years ago)
- Location:
- PinConnection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommTelnet.pas
r411 r412 85 85 PortType: TTelnetPortType; 86 86 ErrorCount: Integer; 87 OptionsNegotationEnable: Boolean; 87 88 procedure Register(Option: TTelnetOption); 88 89 procedure Unregister(Option: TTelnetOption); … … 147 148 I: Integer; 148 149 begin 149 CheckOption;150 if Telnet.OptionsNegotationEnable then CheckOption; 150 151 try 151 152 RequestData := TBinarySerializer.Create; … … 158 159 RequestData.WriteByte(Byte(Code)); 159 160 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); 165 168 finally 166 169 RequestData.Free; 167 Re questData.Free;170 ResponseData.Free; 168 171 end; 169 172 end; … … 201 204 FActive := AValue; 202 205 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; 204 210 end; 205 211 … … 224 230 end else 225 231 if FState = tsIAC then begin 232 if Data = Byte(tcIAC) then begin 233 RawData.WriteByte(Data); 234 FState := tsNormal; 235 end else 226 236 if Data = Byte(tcSB) then begin 227 237 // Subnegotation -
PinConnection/UCommTelnetComPortOption.pas
r411 r412 88 88 begin 89 89 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; 93 95 end; 94 96 … … 101 103 try 102 104 Request := TBinarySerializer.Create; 105 Request.Endianness := enBig; 103 106 Request.List := TListByte.Create; 104 107 Request.OwnsList := True; … … 121 124 Request.List := TListByte.Create; 122 125 Request.OwnsList := True; 126 Request.Endianness := enBig; 123 127 Response := TBinarySerializer.Create; 124 128 Response.List := TListByte.Create; 125 129 Response.OwnsList := True; 130 Response.Endianness := enBig; 126 131 Request.WriteByte(Byte(cpcSetBaudRate)); 127 132 Request.WriteCardinal(0);
Note:
See TracChangeset
for help on using the changeset viewer.