Solved

Real time data on the web?!

Posted on 2004-04-21
27
240 Views
Last Modified: 2011-10-03
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)
0
Comment
Question by:mersan
  • 15
  • 12
27 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10882558
More info please - help us understand exactly what you are doing

Shane
0
 

Author Comment

by:mersan
ID: 10889711
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.

0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10889752
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
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:mersan
ID: 10889791
Exacly, is this possible?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10889814
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
0
 

Author Comment

by:mersan
ID: 10890077
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.
0
 

Author Comment

by:mersan
ID: 10890236
Correct me if I´m wrong, but you can only run Active X in Internet Explorer.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10890270
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
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10890351
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
0
 

Author Comment

by:mersan
ID: 10891592
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)
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10891733
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
0
 

Author Comment

by:mersan
ID: 10891880
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?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892046
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
0
 

Author Comment

by:mersan
ID: 10892108
Sounds Great. I will start it up, Is D5 working for this, or do I need D7?
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 500 total points
ID: 10892156
D5 will work, and i believe the components for TServerSocket & TClientScoket are on the pallette


if not

uses ... ScktComp; //delphi 7 - dont know what the unit is for delphi 5

 TTClientForm = class(TActiveForm, ITClientForm)
   .....  
  private
    { Private declarations }
  .......
    procedure ClientRead(Sender: TObject; Socket: TCustomWinSocket);
  protected
    { Protected declarations }
  public
    { Public declarations }
    ClientSckt: TClientSocket;
   .......
  end;



procedure TTClientForm.ActiveFormCreate(Sender: TObject);
begin
 ClientSckt:= TClientSocket.Create(Self);
 ClientSckt.Port:= 80;
 ClientSckt.Host :=  'Server IP here';
 CLientSckt.OnRead:= ClientRead;
 ClientSocket1.Active :=  True;
end;

procedure TTClientForm.ActiveFormDestroy(Sender: TObject);
begin
  ClientSckt.Free;
end;

procedure TTClientForm.ClientRead(Sender: TObject; Socket: TCustomWinSocket);
var
 tmpText: String;
begin
 if Socket.RemoteHost = 'Your server ip' then
 tmpText:= Socket.ReceiveText;
end;


Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892313
Sorry,

 ClientSocket1.Active :=  True;

=



ClientSckt.Active:= True;

Shane
0
 

Author Comment

by:mersan
ID: 10892334
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)
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892360
Its not done yet, im still building it

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892361
Its not done yet, im still building it

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892363
I have't done the server code yet

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10892371
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>
0
 

Author Comment

by:mersan
ID: 10892498
OK, roger that. Great. I will check everything in a couple of hours...
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10893080
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
0
 

Author Comment

by:mersan
ID: 10893619
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?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10893680
Yes, i will mail them to you -

Shane
0
 

Author Comment

by:mersan
ID: 10893781
Thanks for your help, I will be online tomorrow again.
0
 

Author Comment

by:mersan
ID: 10902050
Hi there, Tanks alot for your help! Do you think you can mail a copy of your project to me?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question