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

C#

 
GeneralRe: Modems and applications Pin
Judah Gabriel Himango18-May-04 9:58
sponsorJudah Gabriel Himango18-May-04 9:58 
GeneralRe: Modems and applications Pin
Tom Larsen18-May-04 10:25
Tom Larsen18-May-04 10:25 
GeneralRe: Modems and applications Pin
bouli18-May-04 10:28
bouli18-May-04 10:28 
GeneralRe: Modems and applications Pin
Tom Larsen18-May-04 10:33
Tom Larsen18-May-04 10:33 
GeneralRe: Modems and applications Pin
Dave Kreskowiak18-May-04 10:33
mveDave Kreskowiak18-May-04 10:33 
GeneralRe: Modems and applications Pin
bouli18-May-04 10:38
bouli18-May-04 10:38 
GeneralMachines IP Address Pin
Dylan van Heerden18-May-04 8:21
Dylan van Heerden18-May-04 8:21 
GeneralRe: Machines IP Address Pin
Heath Stewart18-May-04 9:35
protectorHeath Stewart18-May-04 9:35 
There's nothing in the .NET FCL that allows you to set your machine's IP address. In fact, it's not a good idea to, anyway. It's not like some user preference that could be changed often.

In any case, such an API is not documented in the Platform SDK. Obviously there's some way to do it, but that doesn't mean it's documented.

If you want to get the machine's IP address, a simple way is like so:
string name = Environment.MachineName;
IPHostEntry host = Dns.GetHostByName(name);
foreach (IPAddress address in host.AddressList)
  if (address.AddressFamily == AddressFamily.InterNetwork)
    return address;
return null;
This would get the IPv4 address, for example.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Machines IP Address Pin
Dylan van Heerden19-May-04 8:39
Dylan van Heerden19-May-04 8:39 
GeneralNetwork Bandwidth and Load Balancing Pin
bouli18-May-04 8:08
bouli18-May-04 8:08 
GeneralRe: Network Bandwidth and Load Balancing Pin
leppie18-May-04 9:04
leppie18-May-04 9:04 
GeneralPopulating a combobox with a listview Pin
mikeyb2518-May-04 7:30
mikeyb2518-May-04 7:30 
GeneralRe: Populating a combobox with a listview Pin
JockerSoft18-May-04 7:51
JockerSoft18-May-04 7:51 
QuestionHow do you format your code? [edit] fixed a bit [/edit] Pin
Adam °Wimsatt18-May-04 7:03
Adam °Wimsatt18-May-04 7:03 
AnswerRe: How do you format your code? [edit] fixed a bit [/edit] Pin
leppie18-May-04 7:07
leppie18-May-04 7:07 
GeneralRe: How do you format your code? [edit] fixed a bit [/edit] Pin
Adam °Wimsatt18-May-04 7:14
Adam °Wimsatt18-May-04 7:14 
GeneralRe: How do you format your code? [edit] fixed a bit [/edit] Pin
leppie18-May-04 8:55
leppie18-May-04 8:55 
GeneralRe: How do you format your code? [edit] fixed a bit [/edit] Pin
Adam °Wimsatt18-May-04 9:11
Adam °Wimsatt18-May-04 9:11 
GeneralRe: How do you format your code? [edit] fixed a bit [/edit] Pin
leppie18-May-04 9:28
leppie18-May-04 9:28 
AnswerRe: How do you format your code? [edit] fixed a bit [/edit] Pin
Heath Stewart18-May-04 9:27
protectorHeath Stewart18-May-04 9:27 
GeneralRe: How do you format your code? [edit] fixed a bit [/edit] Pin
Adam °Wimsatt18-May-04 9:31
Adam °Wimsatt18-May-04 9:31 
GeneralDatagrid quation Pin
Ashki18-May-04 6:18
Ashki18-May-04 6:18 
GeneralRe: Datagrid quation Pin
Heath Stewart18-May-04 6:31
protectorHeath Stewart18-May-04 6:31 
GeneralDeserialization Pin
cristina_tudor18-May-04 5:54
cristina_tudor18-May-04 5:54 
GeneralRe: Deserialization Pin
Heath Stewart18-May-04 6:27
protectorHeath Stewart18-May-04 6: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.