Click here to Skip to main content
15,906,567 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dynamically Declaring and object of a class Pin
Christian Graus13-Jul-07 4:04
protectorChristian Graus13-Jul-07 4:04 
GeneralRe: Dynamically Declaring and object of a class Pin
Sallu174913-Jul-07 4:10
Sallu174913-Jul-07 4:10 
GeneralRe: Dynamically Declaring and object of a class Pin
Giorgi Dalakishvili13-Jul-07 4:16
mentorGiorgi Dalakishvili13-Jul-07 4:16 
AnswerRe: Dynamically Declaring and object of a class Pin
Kevin McFarlane13-Jul-07 4:21
Kevin McFarlane13-Jul-07 4:21 
QuestionCreateControl in another thread Pin
Peterson Luiz13-Jul-07 2:54
Peterson Luiz13-Jul-07 2:54 
AnswerRe: CreateControl in another thread Pin
Patrick Etc.13-Jul-07 7:45
Patrick Etc.13-Jul-07 7:45 
AnswerRe: CreateControl in another thread Pin
S. Senthil Kumar13-Jul-07 17:27
S. Senthil Kumar13-Jul-07 17:27 
QuestionPing Leaking Pin
Malcolm Smart13-Jul-07 2:53
Malcolm Smart13-Jul-07 2:53 
>I have a List<string> of IP Addresses in _check.GroupData. I iterate through the list, pinging, asynchronously, each machine. I've stripped out the vast majority of the code, which is why the stuff below looks functionally useless, but it shows the code I am running which leaks like a seive.

Monitoring with PerfMon you can see the private bytes for the process go sky high, and never come back.

Any ideas?

#using System.Net.NetworkInformation;

override public void Check()
	{
		//ping each machine....asynchronously
		foreach (string ipAddress in _check.GroupData) //a list of IP Addresses
                {
			Ping tmpPing = new Ping();
                        
                        try
                        {
				//keep track of th enumber of async pings we've sent out to the farm
				System.Threading.Interlocked.Increment(ref _pingsOutstanding);

				//tell us when the ping is done
				tmpPing.PingCompleted += new PingCompletedEventHandler(ping_PingCompleted);

				//ping!
				tmpPing.SendAsync(ipAddress , 10000 , ipAddress);
                        }
                        catch (Exception e)
                        {
				//show nasty message
                        }
                }

                while (_pingsOutstanding > 0)
                {
                    //hang around here until we're done
                    System.Threading.Thread.Sleep(1000);
                }
		
		//we're done
            }

	void ping_PingCompleted(object sender, PingCompletedEventArgs e)
        {
		//decrement count
                System.Threading.Interlocked.Decrement(ref _pingsOutstanding);
		//not convinced about the next line, but it doesn't help
                (sender as Ping).Dispose();
                return;
	}



sorry about the layout - pushed for time fixing other stuff!
Cheers

Malc

"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF

AnswerRe: Ping Leaking Pin
kubben13-Jul-07 3:28
kubben13-Jul-07 3:28 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 3:49
Malcolm Smart13-Jul-07 3:49 
GeneralRe: Ping Leaking Pin
Dan Neely13-Jul-07 3:55
Dan Neely13-Jul-07 3:55 
GeneralRe: Ping Leaking Pin
kubben13-Jul-07 3:58
kubben13-Jul-07 3:58 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 4:15
Malcolm Smart13-Jul-07 4:15 
GeneralRe: Ping Leaking Pin
kubben13-Jul-07 4:19
kubben13-Jul-07 4:19 
AnswerRe: Ping Leaking Pin
leppie13-Jul-07 3:43
leppie13-Jul-07 3:43 
GeneralRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 3:51
Malcolm Smart13-Jul-07 3:51 
GeneralRe: Ping Leaking Pin
leppie13-Jul-07 4:07
leppie13-Jul-07 4:07 
AnswerRe: Ping Leaking Pin
Malcolm Smart13-Jul-07 5:03
Malcolm Smart13-Jul-07 5:03 
GeneralRe: Ping Leaking Pin
Dave Kreskowiak13-Jul-07 6:30
mveDave Kreskowiak13-Jul-07 6:30 
QuestionJava to C# eBook Pin
Sukhjinder_K13-Jul-07 2:45
Sukhjinder_K13-Jul-07 2:45 
AnswerRe: Java to C# eBook Pin
Christian Graus13-Jul-07 3:24
protectorChristian Graus13-Jul-07 3:24 
AnswerRe: Java to C# eBook Pin
Paul Conrad13-Jul-07 4:03
professionalPaul Conrad13-Jul-07 4:03 
AnswerRe: Java to C# eBook Pin
PhilDanger13-Jul-07 4:23
PhilDanger13-Jul-07 4:23 
GeneralRe: Java to C# eBook Pin
Sukhjinder_K13-Jul-07 4:28
Sukhjinder_K13-Jul-07 4:28 
GeneralRe: Java to C# eBook Pin
leppie13-Jul-07 4:37
leppie13-Jul-07 4:37 

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.