Re: Mediator example - WeOnlyDo Discussion board

Re: Mediator example (General questions)

by wodDamir, Saturday, November 24, 2007, 19:22 (6007 days ago) @ Valter Sini

Hi Valter,

There is really not much to post. Here is what you should do. Put the following code under a button or in the FormCreate function:
----------------------------------
wodVPNCom1.Mediator.Start(0,8000);
----------------------------------

That code will start the Mediator on port 8000. That's all you need. As for monitoring, you can add the following:
-----------------------------------------------------------------
procedure TForm1.wodVPNCom1MediatorConnected(Sender: TObject;
var IP: OleVariant; Port: Integer; var FromID, ToID, Data,
Allow: OleVariant);
begin
//Add your own code here...
end;

procedure TForm1.wodVPNCom1MediatorDisconnected(Sender: TObject;
var FromID, ToID: OleVariant);
begin
//Add your own code here...
end;

procedure TForm1.wodVPNCom1MediatorExchangeData(Sender: TObject;
var FromID, ToID: OleVariant);
begin
//Add your own code here...
end;
-----------------------------------------------------------------

The last 3 procedures are Events which will enable you monitoring . They will provide you with specific information like the IP the user is connecting, the IP of the user that disconnected etc. Also, the MediatorConnected Event allows you to allow or reject the incoming connection, based on your Allow parameter. If you set it as Allow := False; , the Mediator will deny access to the user.

Hope I helped.

Regards,
Damba


Complete thread: