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

Author Topic: Help clarify  (Read 4826 times)

0 Members and 1 Guest are viewing this topic.

BlockyNewt

  • Newbie
  • *
  • Posts: 4
    • View Profile
Help clarify
« on: September 02, 2020, 01:01:20 pm »
I've started messing around with networking recently and had a few questions that I would like some clearing up on after looking around and finding multiple answers. The questions will revolve around server to multiple client connections.
 
  • Checking if the client is still connected.

    Would it be best to use receive() until It doesn't take anything? I tried using socket.getRemoteAddress() != sf::IpAddress::None, but It didn't seem to do anything.

  • Threading the receive().

    -Never really worked with threading, but I'm curious as to how I can get receive() to work with send() simultaneously. Right now for me, I have to send() then wait for a receive() before I can send again.

  • Selecting different sockets from the client to message.

    First off, how would I even get the other socket values from the server to client? Should I put every socket accepted on the server into a vector or a list? But then back to my first question, how do I get the values of other sockets to my client? Should I just use receive() and store them into another container on the client? And if I want to send a message directly to another client, should I create another socket to an open port on the server and connect the two clients to it? 
   
If my questions have already been answered elsewhere then a link would be much appreciated. I'm sorry, but these are just questions I couldn't really find a clear answer to.

Thanks a bunch in advance.
« Last Edit: September 02, 2020, 01:05:20 pm by BlockyNewt »