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;
};