How to enable built-in Flash/Silverlight policy server

SuperSocket contains a built-in Socket Policy Server for both Flash and Silverlight client. And it's implementation code is included in the assembly SuperSocket.Facility.dll. Thus, to enable the policy server, you need to make sure SuperSocket.Facility.dll exist in SuperSocket run directory firstly, and then add the policy server's configuration node in configuration file, like the following code:

Flash Policy Server
<socketServer>
    <servers>
        <server name="FlashPolicyServer"
                serviceName="FlashPolicyService"
                ip="Any" port="843"
                mode="Async"
                receiveBufferSize="32"
                maxConnectionNumber="100"
                policyFile="Policy\flash.xml"
                clearIdleSession="true">
        </server>
    </servers>
    <services>
        <service name="FlashPolicyService" type="SuperSocket.Facility.PolicyServer.FlashPolicyServer, SuperSocket.Facility" />
    </services>
</socketServer>

Silverlight Socket Server
<socketServer>
    <servers>
        <server name="SilverlightPolicyServer"
                serviceName="SilverlightPolicyService"
                ip="Any" port="943"
                mode="Async"
                receiveBufferSize="32"
                maxConnectionNumber="100"
                policyFile="Policy\silverlight.xml"
                clearIdleSession="true">
        </server>
    </servers>
    <services>
        <service name="SilverlightPolicyService" type="SuperSocket.Facility.PolicyServer.SilverlightPolicyServer, SuperSocket.Facility" />
    </services>
</socketServer>

Note that the policyFile property in server node is your policy file stored path.

Last edited Jun 27, 2011 at 3:53 PM by kerryjiang, version 2

Comments

aapozyan Sep 4, 2012 at 2:00 PM 
I'm trying to enable flash or silverlight by programming (not from config file).
But I can't find how to give policy file path.
The following is my code.

FlashPolicyServer flashServer = new FlashPolicyServer();
flashServer.Setup(new RootConfig(), new ServerConfig
{
Name = "FlashPolicyServer",
ServiceName = "FlashPolicyService",
Ip = "Any",
Port = 843,
Mode = SocketMode.Async,
ReceiveBufferSize = 32,
MaxConnectionNumber = 100,
ClearIdleSession = true
}, SocketServerFactory.Instance);