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

Author Topic: network limits  (Read 3118 times)

0 Members and 1 Guest are viewing this topic.

gmysu

  • Newbie
  • *
  • Posts: 9
    • View Profile
network limits
« on: August 29, 2012, 10:48:48 pm »
Before i'll start doing something serious with sfml, i would like to know if threads will allow me to solve the 64 contections limit of the selector object.

so, will they?

cheers:)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: network limits
« Reply #1 on: August 29, 2012, 10:58:37 pm »
Yes, if you use multiple selectors, one per thread, you can work around this problem.
Laurent Gomila - SFML developer

gmysu

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: network limits
« Reply #2 on: August 30, 2012, 09:50:02 am »
thanks for your reply Laurent:). what if i create something like 1 thread - 1 client model? for lets say 1000 clients?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: network limits
« Reply #3 on: August 30, 2012, 11:57:57 am »
1000 threads will kill your CPU. Don't forget that switching from one thread to another is a heavy operation.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: network limits
« Reply #4 on: August 30, 2012, 03:17:31 pm »
thanks for your reply Laurent:). what if i create something like 1 thread - 1 client model? for lets say 1000 clients?
I'm not sure what you want to do, but it sounds like you don't have that much knowledge on networking and that you want to do some crazy thing that would need 1000 clients or so.
I suggest you first dig deeper into the material and read some books on networking. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gmysu

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: network limits
« Reply #5 on: August 30, 2012, 10:04:39 pm »
thanks for your reply Laurent:). what if i create something like 1 thread - 1 client model? for lets say 1000 clients?
I'm not sure what you want to do, but it sounds like you don't have that much knowledge on networking and that you want to do some crazy thing that would need 1000 clients or so.
I suggest you first dig deeper into the material and read some books on networking. ;)

oh its a small project, im just wondering if im able to put together something with more than 100 peers connected. i created two threads, where i placed blocking listener accepting connections in one of them, and loop that goes through connected clients in the other. 1000 threads was a sick idea, i must admit :> thanks for your help though:)

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: network limits
« Reply #6 on: September 20, 2012, 07:25:40 pm »
Coming from a networking background, I've personally set up a system using 'blocks' of clients. I usually set up an array of sockets in a struct (perhaps with some other header-type info about the block), and then have an array of those 'blocks' (along with some more optional header info).

The total number of clients you can support would be the number of blocks times the number of sockets in the block.

Each block is then given a thread. When you add/remove clients, check if the size is coming from/going to 0 and suspend the thread.

Make sure to set the clients to non-blocking, so you can just loop in that thread checking for each client.

This has been proven and works; however, not for SFML. I imagine the process would be similar, if not easier.

Just my 2 cents. Cheers!
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

 

anything