End

When clicking on a button, the client program reads the current value and passes it as parameter to the server152 (notice you cannot run the server twice, as you cannot have the same listening socket at the same port opened by two applications at the same time on a computer):

procedure TFormDsmcMain.btnStartServerClick(

Sender: TObject); var aStr: AnsiString; begi n

Log (rgLifeCycle.Items[rgLifeCycle.ItemIndex]); aStr := 'DsnapMethodsServer.exe ' +

rgLifeCycle.Items[rgLifeCycle.ItemIndex]; WinExec (PAnsiChar (aStr), CmdShow); end;

Now the main form of the client application also has a button used to create instances of the secondary form, which are destroyed when they are closed (in their OnClose event handler), closing the specific connection to the server. Another button is used to log the status of the current client forms:

procedure TFormDsmcMain.btnUpdateStatusClick(

Sender: TObject); var

I: Integer; begi n for I := 0 to Screen.FormCount - 1 do if Screen.Forms[I].ClassType = TFormDsmcClient then Log (IntToStr (I) + ': ' + Screen.Forms[I].ToString);

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment