About IP Problem !!

  • Thread starter Thread starter MingChih Tsai
  • Start date Start date
M

MingChih Tsai

Hi there,

How should I do if I want to release/renew IP in C# ?

Thanks!!

Best regards,
Paul
 
Try This:

private void RenewIpConfig()
{
System.Diagnostics.Process p = new
System.Diagnostics.Process();
System.IO.StreamWriter sw;
System.IO.StreamReader sr;
System.IO.StreamReader err;

System.Diagnostics.ProcessStartInfo psI = new
System.Diagnostics.ProcessStartInfo("cmd");
psI.UseShellExecute = false;
psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;

p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;

sw.AutoFlush = true;
sw.WriteLine("ipconfig /renew");
sw.Close();

System.Diagnostics.Debug.WriteLine("Returned Info: " +
sr.ReadToEnd());
System.Diagnostics.Debug.WriteLine("Errors: " +
err.ReadToEnd());
}
 
Hi,


I think that opennetcf.org has some code for this, check it out


cheers,
 
Back
Top