SuperSocket 中内置的 Flash/Silverlight 策略服务器

关键字: 策略服务器, Flash策略服务器, Silverlight策略服务器, Policy Server, Flash Policy Server, Silverlight Policy Server

SuperSocket 包含一个可用于Flash和Silverlight的Socket策略服务器。 它被包含在SuperSocket.Facility.dll 这个程序集内。 因此,你要启用此策略服务器,你首先需要保证程序集SuperSocket.Facility.dll 存在于SuperSocket的运行目录,然后在配置文件中增加策略服务器节点,配置代码如下:

Flash 策略服务器:

  1. <?xml version="1.0"?>
  2. <configuration>
  3. <configSections>
  4. <section name="superSocket" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine" />
  5. </configSections>
  6. <appSettings>
  7. <add key="ServiceName" value="SupperSocketService" />
  8. </appSettings>
  9. <superSocket>
  10. <servers>
  11. <server name="FlashPolicyServer"
  12. serverType="SuperSocket.Facility.PolicyServer.FlashPolicyServer, SuperSocket.Facility"
  13. ip="Any" port="843"
  14. receiveBufferSize="32"
  15. maxConnectionNumber="100"
  16. policyFile="Policy\flash.xml"
  17. clearIdleSession="true">
  18. </server>
  19. </servers>
  20. </superSocket>
  21. <startup>
  22. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  23. </startup>
  24. </configuration>

Silverlight 策略服务器:

  1. <?xml version="1.0"?>
  2. <configuration>
  3. <configSections>
  4. <section name="superSocket" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine" />
  5. </configSections>
  6. <appSettings>
  7. <add key="ServiceName" value="SupperSocketService" />
  8. </appSettings>
  9. <superSocket>
  10. <servers>
  11. <server name="SilverlightPolicyServer"
  12. serverType="SuperSocket.Facility.PolicyServer.SilverlightPolicyServer, SuperSocket.Facility"
  13. ip="Any" port="943"
  14. receiveBufferSize="32"
  15. maxConnectionNumber="100"
  16. policyFile="Policy\silverlight.xml"
  17. clearIdleSession="true">
  18. </server>
  19. </servers>
  20. </superSocket>
  21. <startup>
  22. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  23. </startup>
  24. </configuration>

提示:server节点的配置属性policyFile的值为你的策略文件的存放路径。