Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: Returning datatable/dataset by from server in a Multithread Client server socket programming Pin
Eddy Vluggen12-Oct-09 5:25
professionalEddy Vluggen12-Oct-09 5:25 
QuestionTracing different threads Pin
manustone11-Oct-09 2:11
manustone11-Oct-09 2:11 
AnswerRe: Tracing different threads Pin
Keith Barrow11-Oct-09 2:30
professionalKeith Barrow11-Oct-09 2:30 
Questionopen exe file Pin
Member 432709611-Oct-09 1:28
Member 432709611-Oct-09 1:28 
AnswerRe: open exe file Pin
dataminers11-Oct-09 1:53
dataminers11-Oct-09 1:53 
AnswerRe: open exe file Pin
Md. Marufuzzaman11-Oct-09 2:12
professionalMd. Marufuzzaman11-Oct-09 2:12 
AnswerRe: open exe file Pin
Abhijit Jana11-Oct-09 3:50
professionalAbhijit Jana11-Oct-09 3:50 
QuestionGet IP from IPInterfaceProperties Pin
Johan Martensson11-Oct-09 0:33
Johan Martensson11-Oct-09 0:33 
Hi, I'm trying to get the IP, subnet and gateway for my interfaces using IPInterfaceProperties but both UnicastAddresses and GatewayAddresses returns a collection...

How do I know which one to use?

Here is my loop and for now I'm just using UnicastAddresses[0] and GatewayAddresses[0] but that isn't always right

internal static NetworkAdapter[] AddExtraInformation(ArrayList adapters)
{
	NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
	foreach (NetworkAdapter adapter in adapters)
	{
		foreach (NetworkInterface networkInterface in networkInterfaces)
		{
			if (!DescriptionToName(networkInterface.Description).Equals(adapter.DeviceName))
				continue;

			adapter.Name = networkInterface.Name;
			adapter.OperationalStatus = networkInterface.OperationalStatus.ToString();
				
			IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();

			if (ipProperties.UnicastAddresses != null)
				if (ipProperties.UnicastAddresses.Count > 0)
				{
					adapter.Address = ipProperties.UnicastAddresses[0].Address.ToString();
					adapter.SubnetMask = ipProperties.UnicastAddresses[0].IPv4Mask.ToString();
				}
				
			if (ipProperties.GatewayAddresses != null)
				if (ipProperties.GatewayAddresses.Count > 0) 
					adapter.Gateway = ipProperties.GatewayAddresses[0].Address.ToString();
			
			break;
		}
	}
	
	return (NetworkAdapter[])adapters.ToArray(typeof(NetworkAdapter));
}


http://johanmartensson.se - Home of MPEG4Watcher
http://www.tinywebradio.com - Home of TinyWebRadio

AnswerRe: Get IP from IPInterfaceProperties Pin
dataminers11-Oct-09 1:58
dataminers11-Oct-09 1:58 
GeneralRe: Get IP from IPInterfaceProperties Pin
Johan Martensson11-Oct-09 4:07
Johan Martensson11-Oct-09 4:07 
Questionwant dll to change pitch of the sound in C#. Pin
bill khan10-Oct-09 22:51
bill khan10-Oct-09 22:51 
QuestionCustom UserControl and the Designer Pin
softwarejaeger10-Oct-09 22:33
softwarejaeger10-Oct-09 22:33 
AnswerRe: Custom UserControl and the Designer Pin
Henry Minute11-Oct-09 1:18
Henry Minute11-Oct-09 1:18 
QuestionUDP SOCKS5 Help [modified] Pin
murktinez10-Oct-09 21:58
murktinez10-Oct-09 21:58 
AnswerRe: UDP SOCKS5 Help Pin
murktinez11-Oct-09 7:40
murktinez11-Oct-09 7:40 
Questioninternet explorer on page event hook Pin
nchandra.org10-Oct-09 14:01
nchandra.org10-Oct-09 14:01 
QuestionRefresh PropertyGrid on control resize? Pin
xJorDyx10-Oct-09 12:12
xJorDyx10-Oct-09 12:12 
AnswerRe: Refresh PropertyGrid on control resize? Pin
Mycroft Holmes10-Oct-09 12:32
professionalMycroft Holmes10-Oct-09 12:32 
AnswerRe: Refresh PropertyGrid on control resize? Pin
Henry Minute10-Oct-09 12:34
Henry Minute10-Oct-09 12:34 
QuestionWebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 12:02
harold aptroot10-Oct-09 12:02 
AnswerRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 22:26
mveOriginalGriff10-Oct-09 22:26 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 22:31
harold aptroot10-Oct-09 22:31 
GeneralRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 22:53
mveOriginalGriff10-Oct-09 22:53 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 23:07
harold aptroot10-Oct-09 23:07 
GeneralRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 23:27
mveOriginalGriff10-Oct-09 23:27 

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.