1
Network / Re: Tcp server dealing with clients disconnecting
« on: September 28, 2017, 12:59:43 pm »
Thank you so much!
I love you right now!
I love you right now!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
You're making some very basic mistakes here. You should probably look deeper into vectors and smart pointers.
Did you google the error message?Quotewhile (listener.accept(clients[numClients + 1].get()) == sf::Socket::Done)Would be used to accept the newest conection, but I get an error saying that the initial value of reference to non-const must be an lvalue, what does this mean?
It's a C++ error message and I bet you'll find a general explanation of it on StackOverflow or other places.
The best way to get some fast help, is to create a compilable and minimal example that demonstrates the issue. That way anyone can see the full scope and understand what is going on.
The error with the code here doesn't seem to make as much sense to me. It would mean that accept() expects a reference (which it does), but you're passing a r-value object (i.e. temporary variable), which you aren't really. Instead you're passing a raw pointer to the accept function. So that's why I feel the error isn't really describing the problem of the posted code.
while (listener.accept(clients[numClients + 1].get()) == sf::Socket::Done)Would be used to accept the newest conection, but I get an error saying that the initial value of reference to non-const must be an lvalue, what does this mean?