Link to home
Start Free TrialLog in
Avatar of mersan
mersan

asked on

Real time data on the web?!

Iwould like to have an alternative solution with the TWebmodule and use realtime updating data to the webpage. is this possible to solve and if it is, I would like som source (ofcourse more point will be awarded for that)
Avatar of shaneholmes
shaneholmes

More info please - help us understand exactly what you are doing

Shane
Avatar of mersan

ASKER

Hi Shane!
This is what I would like to do.
I have an application that is running on a web server. I would like to be able to show real time data on a website.
Can I use the TWebmodule to push data in to the clients web browser? In some way  keeping the connection open and updating the data continusly.

OK, you want to update the webpage on the web server (in real time), but also, any client browsers currently viewing that page, be updated (realtime) as well?

Shane
Avatar of mersan

ASKER

Exacly, is this possible?
Yes, but not with HTML.

You will need to use ASP.net or ActiveFOrms, etc.


 I personally would use an activeform for the data you are updating.

What exactly are you updating - is it data from a Database?

Shane
Avatar of mersan

ASKER

No it is data from an application. The main issue is that the communication must be http compatible and on port 80 or 443. I do not have never worked with asp.net or Active X. Can you help me to get started with this? I have heard that Active X has alot of security issues and usally is locked down by administrators. Can one use ASP.net instead. I have already made a solution with a java applet, but this didn´t pass the security since I´m using a java socket on another port.
Avatar of mersan

ASKER

Correct me if I´m wrong, but you can only run Active X in Internet Explorer.
Well, what i am proposing is to use an activeform with  a  TClientSocket utilizing your port number -
and then the data from your main program OR  ISAPI/CGI etc, utilizing a  TServerSocket to push the data. I dont Believe you would have any security issues then...

SHane
Yeah, you can only run ActiveX in IE, however, do you actually know someone who still uses Netscape, Cause I sure dont. And if they do - well, touch cookies, get IE!

<SMILE>

Shane
Avatar of mersan

ASKER

Well it is a request from our client. It is preferably that the solution will work with IE, NS and Opera. I don´t know what to say :o)

But still if we can have an Active Form solution working it could be an alternative to my Java applet. Can you do this?
And if you can, how long time could it take? I´m leaving for Cyprus in 28 hours. And I will be back in 2 weeks (there is a limitation with internet there)
What, you want me to write it for you.... sure i get 60.00 / hour - <SMILE>

Create a ActiveForm and add a TClientSocket (Component no longer exists in D7, you need to add the sockets unit to your ActiveForm, and create the TClientSocket on the fly (runtime) and set the properties (i.e. port). Then create the code for the Events (i.e. onListen).

From your main app, you need to do the same thing but with a TServerSocket. Then write the code in its events to send the data to the port.

TServerSocket & TClientSocket are just examples (they are pretty simple). there are others such as Indy, ICS, etc. you could look at.

If you have to implement this in less than 28 hours, well, i suggest you get some " mountain dew" and get going on it....
Then again, we are both not sure that this is what you will need (100%), its a solution to try.

Sorry, but for 125 points, its all i can offer, maybe others would be willing to write the code for you.

If you need help alog the way, with the events, ot other things, i could help then.....


Shane
Avatar of mersan

ASKER

Well I was thinking 500 p for some code just so I can get started. Not the whole thing :) Does this sound like a good deal?
I will draw you up some code. In the meantime, you can get started by creating your activeform project and getting your html code set to imbed it....

SHane
Avatar of mersan

ASKER

Sounds Great. I will start it up, Is D5 working for this, or do I need D7?
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry,

 ClientSocket1.Active :=  True;

=



ClientSckt.Active:= True;

Shane
Avatar of mersan

ASKER

I have to test this first thing in the morning, My compiler at home stopped working. Sorry. Can I get back to you tomorrow? (11 h)
Its not done yet, im still building it

Shane
Its not done yet, im still building it

Shane
I have't done the server code yet

Shane
Here is the html with the imbedded OCX

<HTML>
<H1> Delphi 7 ActiveX Test Page </H1><p>
You should see your Delphi 7 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
        classid="clsid:2BDCDEDA-5A7D-4DB5-A261-CEC6E513B2E8"
        codebase="./TClientFormProj1.ocx#version=1,0,0,0"
        width=350
        height=250
        align=center
        hspace=0
        vspace=0
>
</OBJECT>
</HTML>
Avatar of mersan

ASKER

OK, roger that. Great. I will check everything in a couple of hours...
Here is an example of the Server (your app that will do the actuall updating of info).

SHane

unit UntMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ScktComp, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure ClientWrite(Sender: TObject; Socket: TCustomWinSocket);
    procedure ClientConnect(Sender: TObject; Socket: TCustomWinSocket);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
     ServerSckt: TServerSocket;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
 ServerSckt:= TServerSocket.Create(Self);
 ServerSckt.Port:= 80;
 ServerSckt.OnClientWrite:= ClientWrite;
 ServerSckt.OnClientConnect:= CLientConnect;
 ServerSckt.Active :=  True;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 ServerSckt.Free;
end;

procedure TForm1.ClientWrite(Sender: TObject; Socket: TCustomWinSocket);
begin
 //
end;

procedure TForm1.ClientConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
 ShowMEssage('Client Connected');
end;


end.

Shane
Avatar of mersan

ASKER

is it possible for you to send med your project files? The points is yours any way, but this will save me some
time tomorrow when I get to a computer that works in the morning. I will test it and grant you the points tomorrow. Thanks a bunch. could you send it to mersan@hehe.com?
Yes, i will mail them to you -

Shane
Avatar of mersan

ASKER

Thanks for your help, I will be online tomorrow again.
Avatar of mersan

ASKER

Hi there, Tanks alot for your help! Do you think you can mail a copy of your project to me?