Recent

Author Topic: How to accept only 3 connections ?  (Read 4057 times)

fafastrungen

  • New Member
  • *
  • Posts: 24
How to accept only 3 connections ?
« on: June 29, 2011, 07:19:46 pm »
Hi, I'm using lNet's tcp component and I need a way to allow only 3 connections.
Right now I'm closing sockets inside the onAccept event, but I'd like something more secure.

Thanks in advance.

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: How to accept only 3 connections ?
« Reply #1 on: June 30, 2011, 09:45:01 am »
If you want to stop accepting after N connections you should disconnect the server socket. I'm not sure if this will 100% work, honestly I've never tried.

Try:

Code: [Select]
LNet.IterReset;
Lnet.Iterator.Disconnect;

After all 3 connections were accepted. I'll look into this possibility for 0.7.x

fafastrungen

  • New Member
  • *
  • Posts: 24
Re: How to accept only 3 connections ?
« Reply #2 on: July 01, 2011, 06:38:04 am »
Thanks, but is there any way to use something like: "tpsocket.StopListening" or "tcpsocket.Stop" without disconnect the connected clients ?

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: How to accept only 3 connections ?
« Reply #3 on: July 01, 2011, 12:19:37 pm »
Right now not AFAIK :(

I'll look at it during the weekend.

 

TinyPortal © 2005-2018