Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 658
» Latest member: chansonwater
» Forum threads: 1,004
» Forum posts: 5,127

Full Statistics

Online Users
There are currently 61 online users.
» 0 Member(s) | 59 Guest(s)
Bing, Google

Latest Threads
New update 15.2.1 is avai...
Forum: IntraWeb General Discussion
Last Post: brsoft
06-05-2020, 03:47 PM
» Replies: 3
» Views: 94
Intraweb DUnit Testing
Forum: IntraWeb General Discussion
Last Post: sigiaccio
06-05-2020, 10:36 AM
» Replies: 2
» Views: 1,120
15.1.10->15.2.0 #@!
Forum: IntraWeb General Discussion
Last Post: Alexandre Machado
06-04-2020, 09:20 PM
» Replies: 6
» Views: 131
IdHTTPServer and session ...
Forum: Indy General Discussion
Last Post: rlebeau
06-03-2020, 06:05 PM
» Replies: 5
» Views: 82
How to show a floating wi...
Forum: IntraWeb General Discussion
Last Post: Rolphy Reyes
06-03-2020, 02:23 PM
» Replies: 0
» Views: 36
MessageDlg in Intraweb (m...
Forum: IntraWeb General Discussion
Last Post: a.palladino
06-03-2020, 07:19 AM
» Replies: 7
» Views: 192
Check this out! IntraWeb ...
Forum: IntraWeb General Discussion
Last Post: Alexandre Machado
06-03-2020, 02:04 AM
» Replies: 11
» Views: 393
Bootstrap input change co...
Forum: IntraWeb General Discussion
Last Post: bostjan
06-02-2020, 08:43 PM
» Replies: 0
» Views: 34
How to make IWBS4 works?
Forum: IntraWeb General Discussion
Last Post: Rolphy Reyes
06-02-2020, 08:03 PM
» Replies: 0
» Views: 37
How to read value change...
Forum: IntraWeb General Discussion
Last Post: newsanti
06-02-2020, 02:55 PM
» Replies: 2
» Views: 56

 
  Need to time arrival of TCP socket data, how?
Posted by: BosseB - 11-09-2018, 11:28 AM - Forum: Indy General Discussion - Replies (4)

I am troubleshooting a WiFi UART<=>TCP socket bridge device and I need to verify the arrival times of packets sent via the UART input to the device at the TCP client end.
So in this case I will be sending packets of data via the serial link to the device starting at exactly 1 s intervals.
The packets are rather short, basically date/time strings in pure ASCII like "20181109" and "13:46:17"
My test strings start with STX and end with ETX bytes (0x02 and 0x03 respectively).

Each second the date and time packets are sent back-to-back and then nothing until the next second.
Speed is 38400 baud.

I am using FreePascal 3.0.4 and Lazarus 1.8.0 with the indylaz package installed on a Windows 7 x64 laptop.

Since the data arrive at times the client does not control and indy is blocking I have trouble implementing this checking utility...
What I need is:
- Connect the TIdTCPClient object to the bridge device on port 2101 (this is not a problem)
- Somehow start listening for incoming data
- When a packet has arrived transfer it to the main application for timing and logging purposes.


Probably this needs some kind of thread or a loop with Application.Processmessages, but I am not sure how to approach this...

Any advice available?

I have already implemented a configuration utility for the same WiFi bridge device using Indy, but that only had to deal with handshakes with a command sent from the client and a response being sent back almost instantly.
These commands are not started with STX but ended with ETX.
So this is implemented as follows (excerpt from config utility code), hopefully I could re-use some of that code:


Code:
implementation
const
  STX = 2;
  ETX = 3;

constructor TConfigCommHandler.Create;
begin
  FComm := TIdTCPClient.Create(NIL);
  FComm.IPVersion := Id_IPv4;
  FComm.ReadTimeout := 5000;
  FComm.ConnectTimeout := 5000;
  FTcpConnected := false;
  FComm.OnConnected := OnConnected;
  FComm.OnDisconnected := OnDisconnected;
end;

procedure TConfigCommHandler.OnConnected(Sender: TObject);
begin
  FTcpConnected := true;
end;

procedure TConfigCommHandler.OnDisConnected(Sender: TObject);
begin
  FTcpConnected := false;
end;

procedure TConfigCommHandler.SendCommInfo(Msg: AnsiString);

//Show string in listbox on main form
begin
  if Assigned(FOnComm) then
    FOnComm(Self, Msg);
end;

function TConfigCommHandler.Connect(Server: string; Port: word): boolean;
{Connect connects to the server:port}
begin
  try
    Result := false;
    FComm.Connect(Server, Port);
    while not FTcpConnected do
    begin
      Sleep(1);
    end;
    Result := FTcpConnected;
  except
    on E: Exception do
    begin
      FLastError := E.Message;
    end;
  end;
end;

function TConfigCommHandler.GetItem(Cmd: TIdBytes; var Data: TIdBytes): boolean;
var
  Resp: AnsiString;
  LPos: Integer;
begin
  Result := false;
  SetLength(Data, 0);
  BytesToStr(Cmd, Resp);
  SendCommInfo('=> ' + Resp);
  try
    FComm.IOHandler.Write(Cmd);
    FComm.IOHandler.Write(Byte(ETX));
    FComm.IOHandler.ReadBytes(Data, -1, false);
    Result := Length(Data) > 0;
    if Result then
    begin
      if Data[Length(Data)-1] <> ETX then
      begin
        FLastError := 'Final ETX missing!';
        Result := false;
        SendCommInfo(FLastError);
      end
      else
      begin
        SetLength(Data, Length(Data) -1); //Remove trailing ETX
        BytesToStr(Data, Resp);
        SendCommInfo('<= ' + Resp);
      end;
    end
    else
    begin
      FLastError := 'No data received within timeout!';
      SendCommInfo(FLastError);
    end;
  except
    on E: Exception do
    begin
      Result := false;
      FLastError := 'Exception: ' + E.Message;
      SendCommInfo(FLastError);
      Exit;
    end;
  end;
end;


In the main application the FOnComm procedure is implemented as follows to show incoming data:


Code:
procedure TfrmMainConfig.OnComm(Sender: TObject; Msg: AnsiString);
begin
  lbxComm.Items.Add(Msg);
  lbxComm.ItemIndex := lbxComm.Count-1;
end;

As this test is aimed at nailing some randomly occurring timing problems I need to accurately time the arrival of the packets to see if there is any problem in the bridge device. I want to log any time deviation from the 1000 ms mark so see what is going on.
The real consumer of the data sent trough the bridge is an Android App and I suspect that we might be dealing with a problem in that, but I have to prove it. Different developers....

Print this item

  How to call a URL from server without showing it to client?
Posted by: mhammady - 11-09-2018, 12:32 AM - Forum: IntraWeb General Discussion - Replies (5)

Hello,

I'm trying to call a URL that have a security information from server (IW ISAPI) to another server directly without executing a JS or open a new window at the client.

I Tried IdHTTP, and winnet without success. Both gives unkown error when executed from IW form. Is there is a way to make this call directly from the user session, wait for the results, and then move on accordingly?

I'm using IW 14.2.7 with D XE5


Thx in advance...
Mohamed

Print this item

  upgrade IW 14 to 15, and beyond
Posted by: chiswilson - 11-09-2018, 12:11 AM - Forum: IntraWeb General Discussion - Replies (1)

Hi all,
I am looking to update my old IW14 (from late 2015) to the latest IW 15 Ultimate so I can do SSL, among other things.
Should I assume its fairly easy to move an IW14 project into IW15?
Any gotcha's I should know about?

Im still on Delphi 2010.
I know I'll have to update my TMS component pack but thats only like 40 euro apparently.

Also, AtoZed... Im just wondering... has it been decided, is the upcoming IW17 going to support Delphi 2010?

thanks.

Print this item

  (Indy) Web application get page error
Posted by: xinyiman - 11-07-2018, 10:42 AM - Forum: Indy General Discussion - Replies (3)

Hi, I use indy for my project combined with lazarus where I need a web server. Everything seems to work, but when I try to read the contents of a web page with a token in json, I get (not always errors). In particular. This:

HTTP / 1.1 200 OK Connection: close Content-Length: 397

This is the link to the lazarus forum where I have already posted the problem and where you can find an example to replicate the error. You will see that I tried to read it synapse, but only out of curiosity, to see if the error was replicable. I'm interested in solving the problem related to indy so I remove synapse dependencies from my project.

http://forum.lazarus-ide.org/index.php/t...n.html#new

Thank you

Print this item

  http.sys: Error decoding URL style (%XX) encoded string at position 43
Posted by: ioan - 11-05-2018, 10:27 PM - Forum: IntraWeb General Discussion - Replies (2)

I think I found a problem with decoding query strings in applications built with http.sys.

If I try to open this in an application made with indy, everything works fine:
http://127.0.0.1/?level=sslfaxv3&id=f1mF...8%2FpUHJ%a

If I try to open it with application built with http.sys, I get the error:
Error decoding URL style (%XX) encoded string at position 43

Print this item

  IWCOMPGrids.new.pas
Posted by: UdoBausch - 11-05-2018, 04:00 PM - Forum: IntraWeb General Discussion - Replies (1)

Hello Alexandre,
during installation ov V15.0.15 I get compilation-error in IWCOMPGrids.new.pas
we also have IWCompGrids.pas - with a newer date

Which one is valid ? Huh

It's not a problem do delete the *.new-File out of my project
- but I dont know, if it's the right one

Please give me feedback - Thankyou

Print this item

  [SOLVED] GStack.LocalAddress returns empty
Posted by: capslock - 11-05-2018, 12:38 AM - Forum: Indy General Discussion - Replies (4)

I'm using Indy 10 + fpc + lazarus to build a cross platform app.

GStack.LocalAddress returns the IP address at Windows, but returns empty at Linux, and GStack.LocalAddresses.Count = 0. The machine has an ip address, checked by ifconfig.

Anybody help me?

Thanks,

Gustavo

Print this item

  IntraWb 15.0.15 is out
Posted by: Alexandre Machado - 11-04-2018, 09:28 PM - Forum: IntraWeb General Discussion - No Replies

Hi guys,

there is a new maintenance release available, version 15.0.15:

https://www.atozed.com/2018/11/15-0-15/

Enjoy! :-)

Print this item

  AV on FinalizeDataOperations - Delphi5
Posted by: GrahamRola - 10-31-2018, 01:44 PM - Forum: Indy General Discussion - Replies (1)

Delphi 5
Indy 10 5473

I call List in ftp component and it returns the appropriate data.
when the FinalizeDataOperation; is called I get an AV read of address 0xea5278ed.
I Put a breakpoint at the begin of GetResponse and looked at
the call stack (shown below);

What could possible be causing the AEncoding to be anything other
than Nil?  

Couple of other things of note.
When I place mouse over AAAllowedResponses   it only shows  (226) not ([226, 225, 250]);
There are 9 calls to GetResponse before this final call that all show Nil in AEncoding


Code:
procedure TIdFTP.FinalizeDataOperation;
...
  end else begin
    //ftp.marist.edu returns 250
    GetResponse([226, 225, 250]);  // call that generates AV
  end;
end;



Code:
function TIdTCPConnection.GetResponse(const AAllowedResponses: array of Int16;
 AEncoding: IIdTextEncoding = nil): Int16;
begin  // break point inserted here
  GetInternalResponse(AEncoding);
  Result := CheckResponse(LastCmdResult.NumericCode, AAllowedResponses);
end;


Call Stack
TIdTCPConnection.GetResponse((...),Pointer($55E4E3) as IIdTextEncoding)

Print this item

Sad mcptUnknown is undeclared
Posted by: jeekanhaiya6 - 10-30-2018, 11:00 AM - Forum: Delphi General Discussion - Replies (1)

Hi,

I am migrating my project from delphi 2009 to delphi berlin and using Indy10 in this. 

In class IdMessageCode, it is saying undeclared Identifier mcptUnknown.

Can you explain why is it happening?

Thanks 
kanhaiya

Print this item