Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Count Shared objects created on server

    Hi Experts,

    I am working on a game projects right now. I have created game using Flex and FluorineFx(ASP.NET). In this I have used persistent remote shared object to share the common UI to two players. Now It can be heavy traffic on the server as there might be thousands of games running at a time. So to balance the load on the server, I want to count the shared objects created on the servers. If shared objects on the server exeeds the max limit then I will switch the requests to create sharerd object on the other server.

    So for this, how can I count the shared objects created on the server. Also can I chech that the shared object is created or not on the server, I mean is there any methos which returns any flag based on the checking that shared object of perticular ID is exist or not.

    I would appreciate if I will get quick reply as it is quite urgent for me.

    Thanks in advance.

  • #2
    New to the CF scene
    Join Date
    Feb 2010
    Location
    phx
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do i make a post for my question

    I don't see how I post my question

  • #3
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i would do it like this:
    on serverside , declare a class named ShareObject
    it has a static member object table of type Dictionary
    if u want to check if it is created ,define a id member
    when the constructor is invoked ,count increase by one;


    if u want shareobject to transfer between server and client
    u'd better define serialize and unserialize methods
    then transfer the share objects as string
    and unserialize them from string

    give u some code:
    class ShareObject{
    static Dictionary<int,ShareObject> objectTable;
    int id;
    public ShareObject(string data){
    //if data is null,build a new one ,assign an id,and add to dictionary
    //else,find id in data,check existence,and unserialize it;
    }

    string serialize(){...}
    void unserialize(string data){...}

    static int count(){...}
    static bool existed(id){...}
    static void add(int id,ShareObject obj){...};
    static void remove(int id){...}
    }

    it's too simple,but just
    Last edited by zhangweiit; 03-01-2010 at 06:58 AM. Reason: edit code

  • #4
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi zhangweiit,

    Thanks a lot. I will implement this approach and will let you know if any problem I have.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •