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

Show Posts

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.


Messages - argoran

Pages: [1]
1
OK, thank you !

I will have a try :)

2
From what I remember, getting NotReady means the data has not been fully received. But maybe a part of it. So what you would have to do is calling receive() again and again until everything has been received.

OK, thank you !

And for "Send", "Connect", and "Accept", I should do the same thing ?

3
I don't think you need to use threads here. You can set your sockets in non blocking mode : http://www.sfml-dev.org/documentation/2.0/classsf_1_1Socket.php#a165fc1423e281ea2714c70303d3a9782

But how do you check if the function call (say "Receive") is finished ? They return Socket::NotReady immediately in non-blocking mode.

Maybe with a selector ?

4
I'm trying to implement a network library with sfml 1.6.

This library provides a client/server model where a client can connect to a server and send and receive message between the server, and a server can accept multiple clients' connections and communicate with them.

My problem is for the server.
I want to process the client connections in a non-blocking mode, so in the "update" function of the server it only launches two thread for each connection (one for sending message, one for receiving) and checks for their completion.
I also want to have two message buffers for each client connection, so the server can push message into the sending buffer and the receiving threads will push messages into the receiving buffer. These buffers are critical sections and should be protected by mutexes.

Since the number of clients are undetermined and should be scalable, I cant just define a global mutex (or several glabal mutexes) as in the tutorial because I can never know the number of mutex I need.

Is there a way of dealing with this kind of situation where the number of resources that need to be protected might change dynamically during runtime ?

Or my server model is wrong and I should use some other way to implement non-blocking here ?

Pages: [1]
anything