Network Programming with .Net

I tried to write a code working in the network. Windows API is necessary to build a system related to the network. But I did not want to use APIs. There was no practical reason. I just wanted not to be confused with them, and wanted to use mainly C++/CLI, which I was familiar with.

I found an interesting page related to this problem. (although it is mentioning C#.)

So what I had to do was to write my own code in C++/CLI. It was just to put proper notations. But I found this page was a kind of old documents because some functions were obsolete.

At last, I wrote a new C++/CLI version after reading the page.

#include "stdafx.h"

using namespace System;
using namespace System::Net;

int main(array ^args)
String^ name = (args->Length < 1) ? Dns::GetHostName() : args[0];
array^ addrs = Dns::GetHostEntry(name)->AddressList;
int i = 0;
while(i < addrs->Length){
}catch(Exception^ e){

Console::ReadLine(); //waiting for pushing Enter
return 0;

It is just the beginning. I will start for higher levels.

No comments:

Post a Comment