Re: TCP Queue (Backlog)

Gavin Landon <[email protected]> Fri, 18 Jan 2008 21:35:37 -0600
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <002301c85a4c$5bb98b80$55428846@greenmachine>
Thanks, I ended up going to the newsgroups..   It's been a very long time
since I ran on those..

----- Original Message -----
From: "Peter Osucha" <[email protected]>
To: <[email protected]>
Sent: Friday, January 18, 2008 8:50 PM
Subject: Re: [DOTNET-CX] TCP Queue (Backlog)


> Gavin,
>
> Try the WinForms and Advanced lists at discuss.develop.com
>
> Peter
>
> -----Original Message-----
> From: Discussion relating to the specifics of the C# and Managed C++
> languages [mailto:[email protected]] On Behalf Of Gavin Landon
> Sent: Sunday, January 06, 2008 10:31 PM
> To: [email protected]
> Subject: Re: [DOTNET-CX] TCP Queue (Backlog)
>
> Does anyone know of an active C# list?
>
> ----- Original Message -----
> From: "Gavin Landon" <[email protected]>
> To: <[email protected]>
> Sent: Friday, January 04, 2008 12:05 PM
> Subject: Re: [DOTNET-CX] TCP Queue (Backlog)
>
>
>>I use BeginAcceptSocket() to make it asynchronous..
>>
>> -------
>> public void StartListen()
>> {
>>
>>    //log it
>>    CLog.WriteLine("===========\r\nListing on: " + m_szHost + ":" +
>> m_lPort.ToString() + "\r\n===========", CLog.LOG_TYPE.LOG_INFO);
>>
>>    //start listing on the given port
>>    IPAddress inputDNS_IP =
>> Dns.GetHostEntry(this.m_szHost).AddressList[0];
>>
>>    try
>>    {
>>        //set to listen on specific IP:port
>>        this.svrListener = new TcpListener(inputDNS_IP, this.m_lPort);
>>        //setup timeouts..
>>        this.svrListener.Server.ReceiveTimeout = 30000;
>>        this.svrListener.Server.SendTimeout = 30000;
>>        //start with a backlog "TCP/IP Queue" of 1024
>>        this.svrListener.Start(1024);
>>    }
>>    catch (SocketException e)
>>    {
>>        //log it
>>        CLog.WriteLine("Error while creating the listener: " +
>> e.Message, CLog.LOG_TYPE.LOG_ERR);
>>    }
>>
>>    while (true)
>>    {
>>        // Set the event to nonsignaled state.
>>        clientConnected.Reset();
>>        // Accept the connection.
>>        // BeginAcceptSocket() creates the accepted socket.
>>        this.svrListener.BeginAcceptSocket(new
>> AsyncCallback(DoAcceptSocketCallback), this.svrListener);
>>
>>        //log it
>>        CLog.WriteLine("Socket Listening...", CLog.LOG_TYPE.LOG_INFO);
>>        // Wait until a connection is made and processed before
>>        // continuing.
>>        clientConnected.WaitOne();
>>    }
>> }
>>
>> // Process the client connection.
>> public void DoAcceptSocketCallback(IAsyncResult ar) {
>>    CLog.WriteLine("Client Connecting...", CLog.LOG_TYPE.LOG_INFO);
>>
>>    //Get the listener that handles the client request.
>>    TcpListener listener = (TcpListener)ar.AsyncState;
>>
>>    //End the operation and display the received data on the
>>    //console.
>>    Socket sckConnection = listener.EndAcceptSocket(ar);
>>
>>    //Signal the calling thread to continue.
>>    clientConnected.Set();
>>
>>    //log it
>>    CLog.WriteLine("{" + sckConnection.Handle.ToString() + "} Client
>> Accepted...", CLog.LOG_TYPE.LOG_INFO);
>>
>>    //set vars for Socket Class
>>    CSocket socket = new CSocket(sckConnection, this.m_szHost,
>> this.m_lPort);
>>
>>    //start the thread
>>    Thread th = new Thread(new ThreadStart(socket.Process));
>>    th.Start();
>>
>>    CLog.WriteLine("{" + sckConnection.Handle.ToString() + "} Socket
>> Thread Created...", CLog.LOG_TYPE.LOG_INFO); }
>> -------
>>
>> ----- Original Message -----
>> From: "Shen, ShunMing" <[email protected]>
>> To: <[email protected]>
>> Sent: Friday, January 04, 2008 2:57 AM
>> Subject: Re: [DOTNET-CX] TCP Queue (Backlog)
>>
>>
>> AcceptTcpClient() will remove TCP message from queue; Do you use it in
>> your program ?
>>
>> -----Original Message-----
>> From: Discussion relating to the specifics of the C# and Managed C++
>> languages [mailto:[email protected]] On Behalf Of Gavin
>> Landon
>> Sent: 2008 $BG/ (B1 $B7n (B4 $BF| (B 16:12
>> To: [email protected]
>> Subject: [DOTNET-CX] TCP Queue (Backlog)
>>
>> Morning all..
>>
>> I'm having an issue that I've spent a few days on.   I'm building a web
>> server and when I stress tested the server I got great results, but
>> with one
>> bad one..  I'm getting a lot of socket errors.   I have the following,
>> but
>> this doesn't seem to be working list expected..
>>
>> IPAddress inputDNS_IP =
>> Dns.GetHostEntry(this.m_szHost).AddressList[0];
>> this.svrListener = new TcpListener(inputDNS_IP, this.m_lPort); //setup
>> timeouts..
>> this.svrListener.Server.ReceiveTimeout = 30000;
>> this.svrListener.Server.SendTimeout = 30000; //start with a backlog
>> "TCP/IP Queue" of 1024 this.svrListener.Start(1024);
>>
>> I've changed the backlog param in Start() from 1 to 4096 and no matter
>> what
>> the value it doesn't seem to queue up the TCP message like expected.   Am
>> I
>> missing something?
>>
>> /*Chizl*/
>
> ===================================
> This list is hosted by DevelopMentor $B%g (B  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com