git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@68 b6239004-a887-0f4b-9937-50029ccdca16
79 lines
3.5 KiB
HTML
79 lines
3.5 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="..\styles.css">
|
|
</head>
|
|
<body>
|
|
<img src="..\..\ro.png" alt="" align="right">
|
|
|
|
<!-------------------------------------------------------------------------->
|
|
<p class="h1">
|
|
<span>Bonjour Service Discovery Sample</span>
|
|
</p>
|
|
|
|
<h2>Purpose</h2>
|
|
|
|
<p>
|
|
This sample demonstrates how to use ZeroConf service discovery mechanism for
|
|
both publishing and discovering services on the network.</p>
|
|
<h2>
|
|
Prerequisites
|
|
</h2>
|
|
<p>
|
|
Bonjour for Windows is required to run this sample. It can be downloaded free of
|
|
charge from the Apple's website
|
|
<a href="http://support.apple.com/downloads/Bonjour_for_Windows">
|
|
http://support.apple.com/downloads/Bonjour_for_Windows</a>.</p>
|
|
|
|
<h2>How it works</h2>
|
|
<p>
|
|
First, the service have to be made discoverable. To make a service discoverable
|
|
it is necessary to do two things:</p>
|
|
<ul>
|
|
<li>Place and configure <b>TROZeroConfRegistration</b> component on the server's main
|
|
form.</li>
|
|
<li>Call <b>SetZeroConfDetails</b> procedure in the service implementation unit's
|
|
initialization section. </li>
|
|
</ul>
|
|
<p>
|
|
The <b>TROZeroConfBrowser</b> component is used to discover available services on
|
|
the network. Discovery process is performed in the background and corresponding
|
|
events are being fired. When application is notified about new service available
|
|
it have to start resolve procedure to obtain host name (address) and port number
|
|
where to connect to. After hast name and port are obtained, the application can
|
|
construct target URL and connect to the server as ususal.</p>
|
|
<h2>Examine the code</h2>
|
|
<ul>
|
|
<li>See the how the <b>TROZeroConfRegistration</b> component is configured on the
|
|
server's main form.</li>
|
|
<li>See how the <b>SetZeroConfDetails</b> procedure is being called in the
|
|
service implementation unit. Notice how service type is specified there.</li>
|
|
<li>See the how the <b>TROZeroConfBrowser</b> component is configured on the client
|
|
side.</li>
|
|
<li>Examine <b>TClientForm.ROZeroConfBrowserServiceAdded</b> and <b>
|
|
TClientForm.ROZeroConfBrowserServiceRemoved</b> event handler to see how the client
|
|
application responds to service availability change. Notice that these handlers
|
|
are called in the thread other than GUI main. So special processing is required to
|
|
interact with GUI components. In this sample main thread invokation is
|
|
implemented usning custom windows messages. Message parameters lParam and wParam
|
|
contain pointer to the procedure to be called and pointer to the procedure's
|
|
parameter.</li>
|
|
<li>Examine <b>TClientForm.btUseServiceClick</b> to see how <b>TargetURL</b> is constructed.</li>
|
|
</ul>
|
|
|
|
|
|
|
|
<h2>Getting started</h2>
|
|
<ul>
|
|
<li>Build the sample.</li>
|
|
<li>Start the server application. Server's responce string can be changed.
|
|
Start the server with the 'Start server' button.</li>
|
|
<li>Start the client application and see how server is discovered.</li>
|
|
<li>Click 'Use service' button to communicate with the server.</li>
|
|
<li>Try to run several servers on several machines or local host. See how
|
|
services list changes when servers are being
|
|
started and stopped. Select discovered services from the list and invoke
|
|
different remote services. </li>
|
|
</ul>
|
|
</body>
|
|
</html>
|