Click here to Skip to main content
15,915,509 members
Home / Discussions / C#
   

C#

 
Questiondesign report at runtime? Pin
dinh van hai1-Dec-05 22:52
dinh van hai1-Dec-05 22:52 
QuestionPrinting Theory?!??! Pin
tatchung1-Dec-05 22:22
tatchung1-Dec-05 22:22 
AnswerRe: Printing Theory?!??! Pin
mcljava2-Dec-05 10:56
mcljava2-Dec-05 10:56 
GeneralRe: Printing Theory?!??! Pin
tatchung4-Dec-05 14:55
tatchung4-Dec-05 14:55 
QuestionHow to get the Windows color theme? Pin
Pikebu1-Dec-05 21:46
Pikebu1-Dec-05 21:46 
AnswerRe: How to get the Windows color theme? Pin
Insincere Dave2-Dec-05 6:20
Insincere Dave2-Dec-05 6:20 
Questionsocket - client Pin
Ankit Aneja1-Dec-05 20:29
Ankit Aneja1-Dec-05 20:29 
AnswerRe: socket - client Pin
mcljava2-Dec-05 7:45
mcljava2-Dec-05 7:45 
All you gotta do is have an IF statement check the number of clients. Now would I recommend hardcoding 25.... nope. Read the restriction quantity from a config file. That way you can change the number of supported clients without recompiling the code. Your app would read in the parameter at startup and pass it to the listen class. The you would have something like:

class listen<br />
{<br />
  .<br />
  .<br />
  .<br />
<br />
  uint mClientCount = 0;<br />
  uint mClientLimit = 0;  // the value read in from the mainline code<br />
  .<br />
  .<br />
  .<br />
<br />
public listen(uint limit)<br />
{<br />
  mClientLimit = limit;  // store the client connections we support<br />
}<br />
<br />
public void startListen()<br />
{<br />
  .<br />
  .<br />
  .<br />
  if (mClientCount < mClientLimit)<br />
  {<br />
     cl= new client(server.AcceptTcpClient());<br />
     tcpthread=new Thread(new ThreadStart(cl.getClient));<br />
     tcpthread.Start();<br />
     ++mClientCount; <br />
  }<br />
  .<br />
  .<br />
  .<br />
<br />
}<br />

Note: make sure you decrement mClientCount in your Disconnect logic so that you counter stays accurate. Since you are using threads, you will have to manage the synchronized access to the
client counter. You can use lock {} or use a Mutex, or AutoResetEvent depending on your preference and performance needs.

Good luck!


Mike
Questionis it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
sridevi20051-Dec-05 19:26
sridevi20051-Dec-05 19:26 
AnswerRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
S. Senthil Kumar1-Dec-05 20:15
S. Senthil Kumar1-Dec-05 20:15 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
sridevi20052-Dec-05 17:50
sridevi20052-Dec-05 17:50 
AnswerRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
leppie1-Dec-05 20:18
leppie1-Dec-05 20:18 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
sridevi20051-Dec-05 23:10
sridevi20051-Dec-05 23:10 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
Rob Philpott1-Dec-05 23:26
Rob Philpott1-Dec-05 23:26 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
sridevi20052-Dec-05 17:33
sridevi20052-Dec-05 17:33 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
leppie1-Dec-05 23:29
leppie1-Dec-05 23:29 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
Alvaro Mendez2-Dec-05 3:31
Alvaro Mendez2-Dec-05 3:31 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
Dan Neely2-Dec-05 3:58
Dan Neely2-Dec-05 3:58 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
Rob Philpott1-Dec-05 23:24
Rob Philpott1-Dec-05 23:24 
GeneralRe: is it possible for string type constants to be declared in interfaces in C#.net,urgent plz Pin
sridevi20052-Dec-05 17:49
sridevi20052-Dec-05 17:49 
QuestionAny good algorithm for Indexing Pin
adi024461-Dec-05 18:12
adi024461-Dec-05 18:12 
AnswerRe: Any good algorithm for Indexing Pin
Judah Gabriel Himango1-Dec-05 18:26
sponsorJudah Gabriel Himango1-Dec-05 18:26 
GeneralRe: Any good algorithm for Indexing Pin
adi024463-Dec-05 16:44
adi024463-Dec-05 16:44 
QuestionProcess Execution Detection Pin
Shanila1231-Dec-05 17:26
Shanila1231-Dec-05 17:26 
AnswerRe: Process Execution Detection Pin
mcljava2-Dec-05 8:22
mcljava2-Dec-05 8:22 

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.