System.Net.Dll
-
Hey guys sorry if this is a mind numbing question, but i am new to .net programming :eek:. I have begun to write a small little chat program that will 2 users to connect to each other and send text messages and files. I would like to display the ip address of the user in the window and i found this great article... http://www.codeproject.com/csharp/network.asp Unfortunatly I cant seem to access the DNS class. At the end of the article the author says to make sure you have the System.Net.dll file in your reference list, however after doing a search of my hard drive the file cannot be found (yes I have the framework installed). Also could someone tell me the difference between "using namespace Whatever" and "using Whatever", Im familiar with namespaces, but not with just the plain ol using directive... Thank you!
-
Hey guys sorry if this is a mind numbing question, but i am new to .net programming :eek:. I have begun to write a small little chat program that will 2 users to connect to each other and send text messages and files. I would like to display the ip address of the user in the window and i found this great article... http://www.codeproject.com/csharp/network.asp Unfortunatly I cant seem to access the DNS class. At the end of the article the author says to make sure you have the System.Net.dll file in your reference list, however after doing a search of my hard drive the file cannot be found (yes I have the framework installed). Also could someone tell me the difference between "using namespace Whatever" and "using Whatever", Im familiar with namespaces, but not with just the plain ol using directive... Thank you!
Ok, After searching around I found out that there is no System.Net.dll file as it is included in the System.dll file. However i still can not access the DNS class (in my projects dll). In my project I am using VB.net for creating the windows form and I am also using a dll written in managed c++. I am able to use the statement "Imports System.Net" in my VB code fine and i have access to the DNS class within ok, however i want access to it in my c++ dll and i am going crazy trying to figure it out.... here is a little sample of what i am trying...
#pragma once #using // This statment allows me to use... // | using namespace System; // \|/ using namespace System::Net; // this without getting compile errors however // I still cant use the DNS class! help // I need the C++ equivilent of VB's // Imports System.Net namespace SkillzLib { public __gc class NetConnect { private: int portListen; int portSend; String* IPMe; String* IPYou; String* HostName; public: NetConnect(); void Connect(); void Disconnect(); void SetListen(int port) {portListen = port;} void SetSend(int port) {portSend = port;} void SetIPMe(String* address) {IPMe = address;} void SetIPYou(String* address) {IPYou = address;} int GetListen() {return portListen;} int GetSend() {return portSend;} String* GetIPMe() {return IPMe;} String* GetIPYou() {return IPYou;} }; }
-
Ok, After searching around I found out that there is no System.Net.dll file as it is included in the System.dll file. However i still can not access the DNS class (in my projects dll). In my project I am using VB.net for creating the windows form and I am also using a dll written in managed c++. I am able to use the statement "Imports System.Net" in my VB code fine and i have access to the DNS class within ok, however i want access to it in my c++ dll and i am going crazy trying to figure it out.... here is a little sample of what i am trying...
#pragma once #using // This statment allows me to use... // | using namespace System; // \|/ using namespace System::Net; // this without getting compile errors however // I still cant use the DNS class! help // I need the C++ equivilent of VB's // Imports System.Net namespace SkillzLib { public __gc class NetConnect { private: int portListen; int portSend; String* IPMe; String* IPYou; String* HostName; public: NetConnect(); void Connect(); void Disconnect(); void SetListen(int port) {portListen = port;} void SetSend(int port) {portSend = port;} void SetIPMe(String* address) {IPMe = address;} void SetIPYou(String* address) {IPYou = address;} int GetListen() {return portListen;} int GetSend() {return portSend;} String* GetIPMe() {return IPMe;} String* GetIPYou() {return IPYou;} }; }
Ok after some hair pulling and entering random code i did it! Why what i did works...I have no idea. I would REALLY appreciate it if someone could explain it to me. The article i referenced in the first post used c# (i think because it sure as hell wouldnt work in my c++ code). Here is what i got... The article used... using System; using System.Net; Then later had... String strHostName = new String (""); strHostName = DNS.GetHostName (); I finally got it working in my c++ dll by using... #using //If i dont use it i get... using namespace System; using namespace System::Net; // error C2039: 'Net' : is not a member of 'System' And later i used... HostName = new String(""); HostName = Dns::GetHostName(); Now could someone please try and explain this. I though there was a class called DNS (all caps), but i had to resort to some Dns 'thing' (NOT all caps) with the :: notation to get at the GetHostName() function. This doesnt make sence to me since i though the .net framework was supposed to be language independent, yet it seems as if DNS and Dns are 2 different things. Thanks in advance!
-
Ok after some hair pulling and entering random code i did it! Why what i did works...I have no idea. I would REALLY appreciate it if someone could explain it to me. The article i referenced in the first post used c# (i think because it sure as hell wouldnt work in my c++ code). Here is what i got... The article used... using System; using System.Net; Then later had... String strHostName = new String (""); strHostName = DNS.GetHostName (); I finally got it working in my c++ dll by using... #using //If i dont use it i get... using namespace System; using namespace System::Net; // error C2039: 'Net' : is not a member of 'System' And later i used... HostName = new String(""); HostName = Dns::GetHostName(); Now could someone please try and explain this. I though there was a class called DNS (all caps), but i had to resort to some Dns 'thing' (NOT all caps) with the :: notation to get at the GetHostName() function. This doesnt make sence to me since i though the .net framework was supposed to be language independent, yet it seems as if DNS and Dns are 2 different things. Thanks in advance!
Hi, you are using a case sensitive language, DNS and Dns are not the same thing. System.Net.Dns is the correct name, not System.Net.DNS GetHostName is a static method, that's why Dns::GetHostName(); is the proper syntax. Hope this helps.