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

Author Topic: [SOLVED]error with pointers...  (Read 9311 times)

0 Members and 1 Guest are viewing this topic.

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
[SOLVED]error with pointers...
« on: March 01, 2013, 11:56:49 am »
Quote
D:\Documents and Settings\Hinc\Pulpit\html\Serwer\src\Server.cpp:13:43: error: request for member 'Socket' in 'client', which is of pointer type 'Client*' (maybe you meant to use '->' ?)
D:\Documents and Settings\Hinc\Pulpit\html\Serwer\src\Server.cpp:19:40: error: request for member 'Socket' in 'client', which is of pointer type

i know, it's stupid error, but idk how fix it lol

void Server::Select( int port )
{
    Listener.listen( port );
    if ( Selector.wait() )
    {
        // Test the listener
        if ( Selector.isReady( Listener ) )
        {
            // The listener is ready: there is a pending connection
            Client *client = new Client;
            if ( Listener.accept( *client.Socket ) == sf::Socket::Done )
            {
                // Add the new client to the clients list
                clients.push_back( client );
                // Add the new client to the selector so that we will
                // be notified when he sends something
                 Selector.add( *client.Socket );
            }
        }
    }
}


class Server
{
    public:
        void Select( int port );
        void Recv();
    private:
        sf::TcpListener Listener;
        sf::SocketSelector Selector;
        std::vector<Client*> clients;
};

class Client
{
    public:
        sf::TcpSocket Socket;
        sf::Packet Send;
        sf::Packet Recv;
        int ClientID;
};
« Last Edit: March 01, 2013, 03:09:40 pm by Soul »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: error with pointers...
« Reply #1 on: March 01, 2013, 12:00:49 pm »
The solution is written in the error message.

client->Socket
Laurent Gomila - SFML developer

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: error with pointers...
« Reply #2 on: March 01, 2013, 12:25:11 pm »
oh, i see lol'd silly me xD

 

anything