Thursday, December 11, 2014

What is the simplest way to solve "Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on"

Code Example

Replace
list.Items.Add(status);
with:
                    this.Invoke((MethodInvoker)delegate
                    {
                        //list.Items.Add(status);
                    });


C# Naming Conventions with example

use PascalCasing for class names and method names.
use camelCasing for method arguments and local variables
use noun or noun phrases to name a class.
prefix interfaces with the letter I.  Interface names are noun (phrases) or adjectives.

References:
http://msdn.microsoft.com/en-us/library/ms229043.aspx
http://www.dofactory.com/reference/csharp-coding-standards

Wednesday, December 10, 2014

How to list all of listening ports in Windows command prompt?

netstat -anb | findstr /R /C:"[LISTENING]"

How to solve problem "No connection could be made because the target machine actively refused it"

#1 reason is: target machine TCP not listening.
Can run following command line to check:
netstat -anb