Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
AnswerRe: Basic SQL connection through classes Pin
i.j.russell26-Jan-10 0:57
i.j.russell26-Jan-10 0:57 
GeneralRe: Basic SQL connection through classes Pin
Not Active26-Jan-10 1:51
mentorNot Active26-Jan-10 1:51 
GeneralRe: Basic SQL connection through classes Pin
PIEBALDconsult26-Jan-10 4:11
mvePIEBALDconsult26-Jan-10 4:11 
GeneralRe: Basic SQL connection through classes Pin
#realJSOP26-Jan-10 6:45
mve#realJSOP26-Jan-10 6:45 
GeneralRe: Basic SQL connection through classes Pin
PIEBALDconsult26-Jan-10 6:52
mvePIEBALDconsult26-Jan-10 6:52 
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 
Hi,
I would like to code a TCP/UDP server and I've coded a major part of it but it seems like if the server is busy, then I will have a problem.

Here is my Listening code:
private void Listen()
{
  Console.WriteLine( "Listening port " + port.ToString() +"." );
  listener.Start();

  while (KeepWorking)
  {
    // Waiting until a client requests to connect.
    TcpClient client = listener.AcceptTcpClient();

    Console.WriteLine("---------------------");
    Console.WriteLine(client.Client.RemoteEndPoint.ToString() + " connected.");
    ClientHistory.Add( client.Client.RemoteEndPoint.ToString() );

    ThreadPool.QueueUserWorkItem(new WaitCallback(HandleCommunication), client);
  }
}


If more than one client requests to connect at the same time then one won't be able to connect because I am not listening.

If a client connects and before it's queued to ThreadPool another client wants to connect, it won't be able to connect because I am not listening again.

Is there a way to solve this or is this how every server works? Smile | :)

Thanks.

modified on Tuesday, January 26, 2010 5:24 AM

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 
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 

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.