Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to refuse Connections ?

Reply
Thread Tools

How to refuse Connections ?

 
 
victor
Guest
Posts: n/a
 
      04-02-2007
I want my code to accept only connections to the max of N.. if any
client tries to connect to my code when already there are N
connections, then it musst be refused... How do i do it?
P.S::: I can accept the connection then close the socket.. But is
there any other elegant way?

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      04-02-2007
victor wrote:
> I want my code to accept only connections to the max of N.. if any
> client tries to connect to my code when already there are N
> connections, then it musst be refused... How do i do it?
> P.S::: I can accept the connection then close the socket.. But is
> there any other elegant way?
>

You'd better ask this on a platform specific programming group, sockets
and friends are off topic here.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Bill Pursell
Guest
Posts: n/a
 
      04-02-2007
On Apr 2, 5:07 am, "victor" <(E-Mail Removed)> wrote:
> I want my code to accept only connections to the max of N.. if any
> client tries to connect to my code when already there are N
> connections, then it musst be refused... How do i do it?
> P.S::: I can accept the connection then close the socket.. But is
> there any other elegant way?



This is not a question about C. You would probably
have better results posting to comp.programming or
some other group.


 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      04-02-2007
victor wrote:

> I want my code to accept only connections to the max of N.. if any
> client tries to connect to my code when already there are N
> connections, then it musst be refused... How do i do it?


There are no networking capabilities in standard C. It's all platform
dependent. You need to find a newsgroup dedicated to yours.

If you're using UNIX, comp.unix.programmer would be the place.




Brian
 
Reply With Quote
 
victor
Guest
Posts: n/a
 
      04-02-2007
On Apr 2, 9:07 am, "victor" <(E-Mail Removed)> wrote:
> I want my code to accept only connections to the max of N.. if any
> client tries to connect to my code when already there are N
> connections, then it musst be refused... How do i do it?
> P.S::: I can accept the connection then close the socket.. But is
> there any other elegant way?


Thanx.

 
Reply With Quote
 
Tor Rustad
Guest
Posts: n/a
 
      04-04-2007
victor wrote:
> I want my code to accept only connections to the max of N.. if any
> client tries to connect to my code when already there are N
> connections, then it musst be refused... How do i do it?
> P.S::: I can accept the connection then close the socket.. But is
> there any other elegant way?


After you call listen(), the socket enter the LISTEN state. When client
connect, it send SYN, which enter a incomplete connection queue on
server. Server replies with SYN+ACK, and socket enter the SYN_RCVD state.

Unless client try a SYN flood attack, it will reply with ACK. When the
ACK is received at server, the socket enter the ESTABLISHED state and is
moved from the incomplete queue to the complete queue.

Now, if accept() is called by the server, you remove it from the
completed queue.

Why would need another way to remove a connection from the completed queue?

If you don't remove it, you will sooner or later trigger a SYN flood on
your own!

--
Tor
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Web pages refuse to open The One Firefox 4 05-21-2005 11:00 AM
Why connet refuse?? wolf ASP .Net 0 02-19-2004 03:11 PM
SecureACS refuse/allow attribute problem Jason Kau Cisco 1 07-21-2003 09:53 PM
Re: Debuger suddenly refuse to debug Bisser Milanov ASP .Net 1 06-26-2003 09:02 PM



Advertisments