Click here to Skip to main content
15,892,697 members
Home / Discussions / C#
   

C#

 
QuestionShow/Hide Quick Launch Toolbar on Button Click Pin
sherwani17-Mar-06 1:06
sherwani17-Mar-06 1:06 
QuestionHow to handle Window Context Menu events ? Pin
sherwani17-Mar-06 1:02
sherwani17-Mar-06 1:02 
AnswerRe: How to handle Window Context Menu events ? Pin
CoolASL17-Mar-06 3:41
CoolASL17-Mar-06 3:41 
GeneralRe: How to handle Window Context Menu events ? Pin
sherwani17-Mar-06 3:43
sherwani17-Mar-06 3:43 
AnswerRe: How to handle Window Context Menu events ? Pin
CoolASL17-Mar-06 3:58
CoolASL17-Mar-06 3:58 
QuestionHow to handleTwo events ? Pin
sherwani17-Mar-06 1:00
sherwani17-Mar-06 1:00 
QuestionIdentify opened ports in local machine Pin
deepthi wilson17-Mar-06 0:03
deepthi wilson17-Mar-06 0:03 
AnswerRe: Identify opened ports in local machine Pin
Jijo BP17-Mar-06 0:07
Jijo BP17-Mar-06 0:07 
I think this will solve your problem :
try {
int port = FindUnusedPort(IPAdress.Any);


}


catch (SocketException) {
// no free ports


}


...

using System;
using System.Net;
using System.Net.Sockets;


...


public int FindUnusedPort(IPAddress localAddr) {
for (int p = 1024; p <= IPEndPoint.MaxPort; p++) {


Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
try {
s.Bind(new IPEndPoint(localAddr, p));
s.Close();
return p;
}
catch (SocketException ex) {
// EADDRINUSE?
if (ex.ErrorCode == 10048)
continue;
else
throw;
}
}
throw new SocketException(10048);
}


Cheers
JIjo
AnswerRe: Identify opened ports in local machine Pin
Vasudevan Deepak Kumar17-Mar-06 0:45
Vasudevan Deepak Kumar17-Mar-06 0:45 
QuestionOpen only one child form Pin
Boipelo16-Mar-06 22:47
Boipelo16-Mar-06 22:47 
AnswerRe: Open only one child form Pin
akyriako7816-Mar-06 23:47
akyriako7816-Mar-06 23:47 
AnswerRe: Open only one child form Pin
pawan kumarsoft4-Nov-10 6:20
pawan kumarsoft4-Nov-10 6:20 
QuestionHashtable Pin
Eytukan16-Mar-06 22:34
Eytukan16-Mar-06 22:34 
AnswerRe: Hashtable Pin
Nicholas Butler16-Mar-06 23:31
sitebuilderNicholas Butler16-Mar-06 23:31 
GeneralRe: Hashtable Pin
Eytukan17-Mar-06 0:01
Eytukan17-Mar-06 0:01 
QuestionI get an error when my textbox has texts with html tags Pin
CandyMe16-Mar-06 22:29
CandyMe16-Mar-06 22:29 
AnswerRe: I get an error when my textbox has texts with html tags Pin
jimjo17-Mar-06 1:21
jimjo17-Mar-06 1:21 
QuestionI get error when I have html tags in textbox Pin
CandyMe16-Mar-06 22:28
CandyMe16-Mar-06 22:28 
QuestionHow to get "Precision" and "Scale" of a Decimal bound column in code ? Pin
Bobby88716-Mar-06 22:25
Bobby88716-Mar-06 22:25 
AnswerRe: How to get "Precision" and "Scale" of a Decimal bound column in code ? Pin
darkelv17-Mar-06 2:43
darkelv17-Mar-06 2:43 
QuestionCOM Interop and Indigo on Windows Server 2003 Pin
Optimus Chaos16-Mar-06 21:03
Optimus Chaos16-Mar-06 21:03 
QuestionRemote Shutdown and Processes Pin
fjlv200516-Mar-06 20:14
fjlv200516-Mar-06 20:14 
AnswerRe: Remote Shutdown and Processes Pin
Jijo BP16-Mar-06 23:00
Jijo BP16-Mar-06 23:00 
GeneralRe: Remote Shutdown and Processes Pin
fjlv200516-Mar-06 23:26
fjlv200516-Mar-06 23:26 
Questionhow to embed a external application into a winform? Pin
iiiwabibitoiii16-Mar-06 20:06
iiiwabibitoiii16-Mar-06 20:06 

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.