Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can I use client socket grabbed by selector to send data?  (Read 23107 times)

0 Members and 1 Guest are viewing this topic.

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Can I use client socket grabbed by selector to send data?
« on: September 15, 2008, 01:56:36 pm »
Hi.
About tutorial: http://www.sfml-dev.org/tutorials/1.3/network-selector.php

I have a small server of a game with 4 player..
I need to send data from game server to player client only when some data change and not as response to a client question.
I try to extract client socket from selector but don't found how so..

Go all right if i make a copy of client socket in

Code: [Select]
       if (socket==mListener)
        {
            sf::IPAddress address;
            sf::SocketTCP client;
            mListener.Accept(client, &address);
mSelector.Add(client);
clients[iSender++] = client;
        }


How can I store it? Pointers or copy in other socket?

Thanks
^_^=>Il calcolatore รจ straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

zac

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Can I use client socket grabbed by selector to send data?
« Reply #1 on: December 17, 2008, 12:24:22 am »
This is an important question, but I think it should be possible to store a socket into a container class...