Home Forums Support Storing client connection information on server?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #950
    Anonymous
    Inactive

    Hi,
    Thanks for the help so far, it has been really helpful. I have a couple of other questions which I hope you can help me with or give me some guidelines.

    We are still working on the same pokerclient as mentioned earlier and I have been able to send and recieve the information from/to the server/client and the framework is very good and easy, however I need to setup a different approach right now.

    Please have a look at this picture:
    http://postimg.org/image/cdok8yqp9/

    The only thing that the clients should do is:
    1. Connect and Disconnect to the server
    2. Send its action to the server (Call, Raise, Fold etc.)
    3. Animate based on the data recieved from the server

    The server should:
    1. Store all connections from the client
    2. Send the appropiate data to each client

    I was wondering what a good approach would be here using NetworkComms Framwork?

    Right now I send and recieve data from and to the server a little bit sloppy and I would like to redo that part so any input here on how to handle the client connections etc. would be highly appreciated!

    Thanks in advance,
    Best regards,
    Tomas

    Thanks in advance,
    Best regards,
    Tomas

    #951
    Anonymous
    Inactive

    Heya Tomas,

    Good to hear you are making progress. The best answer to your question is that you can decide what the best communication configuration is and then use Networkcomms.Net to implement it. You are not really restricted to one configuration over another. A very brief example of what you might be able to use is:

    List<IPEndPoint> connectedClients = new List<IPEndPoint>();
    NetworkComms.AppendGlobalIncomingPacketHandler<string>("InitialClientConnect", (header, connection, message) =>
        {
            //If a client sends a InitialClientConnect packet we add them to the connectedClients list
            connectedClients.Add(connection.ConnectionInfo.RemoteEndPoint);
        });

    and

    //At some future point we can send something to all connected clients
    string messageToSend = "helloWorld";
    foreach (IPEndPoint endPoint in connectedClients.ToList())
    {
        try
        {
    
            TCPConnection.GetConnection(new ConnectionInfo(endPoint)).SendObject("TestMessage", messageToSend);
        }
        catch (CommsException ex)
        {
            //An exception occured. Inspect the exception 'ex' to determine what went wrong
            //It might be the client is no longer available
        }
    }

    Regards,
    Marc

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.