This code works fine for 1 connection but when I try more it just queues them up and process them after I close the initial one. What am I doing wrong? I am using non-blocking sockets.
sf::Packet PacketRecv;
ss::Packet Packet;
sf::SocketTCP Client;
unsigned short Port = 27015;
sf::IPAddress Sender;
int AcceptStatus = Socket.Accept(Client);
if(AcceptStatus==sf::Socket::Done){
std::cout<<"socket accepted"<<std::endl;
sf::Packet PacketSend;
ss::Packet PacketSendParsed = {0,0,0,0,"loL"};
PacketSend<<PacketSendParsed;
Client.Send(PacketSend);
Clients.push_back(Client);
} else if(AcceptStatus==sf::Socket::Error){
std::cout<<"socket error"<<std::endl;
}
for(int i=0;i<Clients.size();i++){
int RecvStatus = Clients[i].Receive(PacketRecv);
ss::Packet PacketRecvParsed;
if(RecvStatus==sf::Socket::Done){
PacketRecv>>PacketRecvParsed;
std::cout<<PacketRecvParsed.Message;
}
}