-3

DELPHI XE7 on win7 32bit code:

procedure TForm1.IdMappedPortTCP1Execute(AContext: TIdContext);
begin
if (pos('CONNECT',AContext)<>0) or (pos('GET',AContext)<>0) or (pos('POST',AContext)<>0) or   (pos('HEAD',AContext)<>0)
then
(....)
sleep(100);
end;

error:

[dcc32 Error] Unit1.pas(49): E2250 There is no overloaded version of 'Pos' that can be called with these arguments

please help me how to fix that code

thanks in advance

Sugie DK
  • 1
  • 1
  • 3
  • 3
    `TIdContext` probably isn't a string... – Andreas Rejbrand Nov 04 '14 at 13:53
  • You might wanted to operate with `TIdMappedPortContext(AContext).NetData` (which is not string). But without knowing you aim it's just a guess. – TLama Nov 04 '14 at 14:03
  • 3
    Obvious first steps when presented with an error message like that: (1) Identify which overloaded versions of the function exist. (2) Identify the arguments being used. Did you do those things? – Rob Kennedy Nov 04 '14 at 14:50
  • @AndreasRejbrand can you tell me wich one that code made error? @TLama yes i'll use something like that on my previous indy scripts is like this `if (pos('CONNECT',athread.NetData)<>0) or (pos('GET',athread.NetData)<>0) or (pos('POST',athread.NetData)<>0) or (pos('HEAD',athread.NetData)<>0)` that working fine but i wanna change to indy 10 but got that error @RobKennedy m new in delphi – Sugie DK Nov 04 '14 at 23:39

1 Answers1

4

The arguments to Pos are two strings. The functions searches for the first occurrence of a substring (the first parameter) within another string (the second parameter). The function is documented here: http://docwiki.embarcadero.com/Libraries/en/System.Pos

You are passing AContext which is of type TIdContext and that is not a string. To fix the code you need to pass the string that contains the text within which you intend to search.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490