Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
AnswerRe: Basic SQL connection through classes Pin
kevinnicol26-Jan-10 2:39
kevinnicol26-Jan-10 2:39 
AnswerRe: Basic SQL connection through classes Pin
SilimSayo27-Jan-10 3:11
SilimSayo27-Jan-10 3:11 
QuestionA theoretical problem when coding a BUSY TCP/UDP server [modified] Pin
SimpleData25-Jan-10 23:03
SimpleData25-Jan-10 23:03 
AnswerRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
harold aptroot25-Jan-10 23:27
harold aptroot25-Jan-10 23:27 
GeneralRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
SimpleData26-Jan-10 6:55
SimpleData26-Jan-10 6:55 
GeneralRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
harold aptroot26-Jan-10 7:12
harold aptroot26-Jan-10 7:12 
GeneralRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
SimpleData26-Jan-10 8:06
SimpleData26-Jan-10 8:06 
GeneralRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
harold aptroot26-Jan-10 8:38
harold aptroot26-Jan-10 8:38 
Ok, well I was in a good mood and decompiled TcpListener.Start for you.
public void Start()
{
    this.Start(0x7fffffff);
}
public void Start(int backlog)
{
    if ((backlog > 0x7fffffff) || (backlog < 0))
    {
        throw new ArgumentOutOfRangeException("backlog");
    }
    if (Logging.On)
    {
        Logging.Enter(Logging.Sockets, this, "Start", (string) null);
    }
    if (this.m_ServerSocket == null)
    {
        throw new InvalidOperationException(SR.GetString("net_InvalidSocketHandle"));
    }
    if (this.m_Active)
    {
        if (Logging.On)
        {
            Logging.Exit(Logging.Sockets, this, "Start", (string) null);
        }
    }
    else
    {
        this.m_ServerSocket.Bind(this.m_ServerSocketEP);
        this.m_ServerSocket.Listen(backlog);  <--- !!see here!!
        this.m_Active = true;
        if (Logging.On)
        {
            Logging.Exit(Logging.Sockets, this, "Start", (string) null);
        }
    }
}


So the result is a call to SomeSocket.Listen(int.MaxValue), which according to the documentation[^]: "Places a Socket in a listening state. Int32 backlog: The maximum length of the pending connections queue."

In other words, don't worry, the connections are being placed in the backlog. Of course it can happen that connections are being made at a faster rate than you can handle them, which is really just a denial of service attack. You can't do anything about that, no matter how many connections per second you can handle, they could just throw 1 more at you and you'd lose.

So it all comes down to "magic happens in the background in code that you didn't write", in a more theoretical setting in which connections are only accepted while you are waiting for them, you would have a theoretical problem. Fortunately real world sockets don't work that way Smile | :)
GeneralRe: A theoratical problem when coding a BUSY TCP/UDP server Pin
SimpleData26-Jan-10 9:23
SimpleData26-Jan-10 9:23 
Questionhow to call java files using c# Pin
Rajeshwar Code- Developer25-Jan-10 22:49
Rajeshwar Code- Developer25-Jan-10 22:49 
AnswerRe: how to call java files using c# Pin
Abhinav S25-Jan-10 22:52
Abhinav S25-Jan-10 22:52 
GeneralRe: how to call java files using c# Pin
Rajeshwar Code- Developer25-Jan-10 22:58
Rajeshwar Code- Developer25-Jan-10 22:58 
AnswerRe: how to call java files using c# Pin
Richard MacCutchan25-Jan-10 22:56
mveRichard MacCutchan25-Jan-10 22:56 
GeneralRe: how to call java files using c# Pin
Rajeshwar Code- Developer25-Jan-10 22:59
Rajeshwar Code- Developer25-Jan-10 22:59 
GeneralRe: how to call java files using c# Pin
Richard MacCutchan25-Jan-10 23:05
mveRichard MacCutchan25-Jan-10 23:05 
GeneralRe: how to call java files using c# Pin
Rajeshwar Code- Developer25-Jan-10 23:27
Rajeshwar Code- Developer25-Jan-10 23:27 
GeneralRe: how to call java files using c# Pin
Richard MacCutchan26-Jan-10 2:29
mveRichard MacCutchan26-Jan-10 2:29 
AnswerRe: how to call java files using c# Pin
Alex Manolescu26-Jan-10 6:15
Alex Manolescu26-Jan-10 6:15 
Questioncrystal report Support Pin
miss YY25-Jan-10 22:47
miss YY25-Jan-10 22:47 
AnswerRe: crystal report Support Pin
Tom Deketelaere26-Jan-10 2:09
professionalTom Deketelaere26-Jan-10 2:09 
QuestionAgentObjects Pin
jojoba201025-Jan-10 20:46
jojoba201025-Jan-10 20:46 
QuestionMessage Removed Pin
25-Jan-10 19:15
arturw8225-Jan-10 19:15 
AnswerRe: Cursor change in WinForms - A generic error occurred in GDI + Pin
Som Shekhar25-Jan-10 19:44
Som Shekhar25-Jan-10 19:44 
GeneralRe: Cursor change in WinForms - A generic error occurred in GDI + Pin
Som Shekhar26-Jan-10 3:07
Som Shekhar26-Jan-10 3:07 
Questionopening Tooltip Pin
jojoba201025-Jan-10 18:32
jojoba201025-Jan-10 18:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.