Click here to Skip to main content
15,867,308 members
Home / Discussions / C#
   

C#

 
GeneralRe: Insert a char in the beginning of the file using c# Pin
N a v a n e e t h2-Mar-09 15:33
N a v a n e e t h2-Mar-09 15:33 
QuestionInsert record Pin
Sajjad Leo2-Mar-09 1:05
Sajjad Leo2-Mar-09 1:05 
AnswerRe: Insert record Pin
Colin Angus Mackay2-Mar-09 2:29
Colin Angus Mackay2-Mar-09 2:29 
GeneralRe: Insert record Pin
Sajjad Leo2-Mar-09 17:50
Sajjad Leo2-Mar-09 17:50 
GeneralRe: Insert record Pin
Colin Angus Mackay2-Mar-09 21:35
Colin Angus Mackay2-Mar-09 21:35 
GeneralRe: Insert record Pin
Sajjad Leo2-Mar-09 23:13
Sajjad Leo2-Mar-09 23:13 
QuestionLimiting maximum connections Pin
invader822-Mar-09 1:00
invader822-Mar-09 1:00 
AnswerRe: Limiting maximum connections Pin
harold aptroot2-Mar-09 1:09
harold aptroot2-Mar-09 1:09 
I's probably use a ManualResetEvent instead of sleeping a thousand times per second - it's more accurate and less of a hack.

ManualResetEvent m = new ManualResetEvent(true);
while(true)
{
	m.WaitOne();
	if(numberOfConnections < 100)
	{
		Socket s = listenerSocket.Accept();
		...
	}
	else
	{
		m.Reset();
	}	
}


And somewhere at a place where you close the connections, do m.Set() if the number of connections is lower than 100 again.

But beware, I just woke up, so don't trust this code or even this idea Smile | :)



AnswerRe: Limiting maximum connections Pin
Luc Pattyn2-Mar-09 3:16
sitebuilderLuc Pattyn2-Mar-09 3:16 
GeneralRe: Limiting maximum connections Pin
harold aptroot2-Mar-09 4:40
harold aptroot2-Mar-09 4:40 
GeneralRe: Limiting maximum connections Pin
invader822-Mar-09 4:35
invader822-Mar-09 4:35 
AnswerRe: Limiting maximum connections Pin
N a v a n e e t h2-Mar-09 1:16
N a v a n e e t h2-Mar-09 1:16 
GeneralRe: Limiting maximum connections Pin
invader822-Mar-09 4:46
invader822-Mar-09 4:46 
GeneralRe: Limiting maximum connections Pin
N a v a n e e t h2-Mar-09 15:32
N a v a n e e t h2-Mar-09 15:32 
AnswerRe: Limiting maximum connections Pin
Luc Pattyn2-Mar-09 3:20
sitebuilderLuc Pattyn2-Mar-09 3:20 
GeneralRe: Limiting maximum connections Pin
invader822-Mar-09 4:59
invader822-Mar-09 4:59 
AnswerRe: Limiting maximum connections Pin
Luc Pattyn2-Mar-09 5:03
sitebuilderLuc Pattyn2-Mar-09 5:03 
Questionland phone call from pc Pin
rizvi_codeproject2-Mar-09 0:29
rizvi_codeproject2-Mar-09 0:29 
GeneralRe: land phone call from pc Pin
Kristian Sixhøj2-Mar-09 4:52
Kristian Sixhøj2-Mar-09 4:52 
Questionprocess details Pin
shefa' isied2-Mar-09 0:22
shefa' isied2-Mar-09 0:22 
AnswerRe: process details Pin
Luc Pattyn2-Mar-09 3:25
sitebuilderLuc Pattyn2-Mar-09 3:25 
QuestionDrag and drop to mouse point location Pin
Low Pei Yang2-Mar-09 0:03
Low Pei Yang2-Mar-09 0:03 
AnswerRe: Drag and drop to mouse point location Pin
Henry Minute2-Mar-09 10:51
Henry Minute2-Mar-09 10:51 
GeneralRe: Drag and drop to mouse point location Pin
Low Pei Yang2-Mar-09 16:13
Low Pei Yang2-Mar-09 16:13 
QuestionIComparer problem Pin
livez1-Mar-09 23:22
livez1-Mar-09 23: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.