|
Advanced scenarios: callbacks and authorization. - Defining client configuration. |
|
|
|
|
Page 7 of 8
Defining client configuration.
- Add app.config file to the MyClient project:

- Modify it adding this piece of text to it:
<system.runtime.remoting>
<application>
<channels>
<channel port="5001" ref="tcp">
<serverProviders>
<provider type="SSB.Runtime.Remoting.TosChannelSinkProvider, SmartChannels" />
<formatter ref="binary" />
</serverProviders>
<clientProviders>
<formatter ref="binary"/>
<provider type="SSB.Runtime.Remoting.TocChannelSinkProvider, SmartChannels" defaultPollingInterval="10" defaultTimeoutInterval="5">
</provider>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
Since our client will act as a client and as a server (to receive callbacks), we specified 2 provider types inside one channel - serverProviders and clientProviders. In the example we define that callbacks will be received on port 5001. We also defined that the channel will use tcp transport with binary formatter for server and client part of the channel. Also, it will use TosChannelSinkProvider to build server role channel and will use TocChannelSinkProvider to form channel for client role. TosChannelSinkProvider and TocChannelSinkProvider is part of SmartChannels library and is responsible to provide reliable communications with ability to detect network timeouts and disconnections.
Congratulations! At the moment you should be able to compile and run server and client parts of the example and test callback functionality.
Good. But here we have one issue. The server we created at the moment accept all connections from all clients. What if you want to restrict incoming connections only by valid clients? There are number of options. But we will use the one available with SmartChannels library - pre-shared key authorization.
|