473,774 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there anyone who can help me?I post it before.

Greeting All!

Is some one who can help me?

The problem is when I use a func(_GetDNSSer vers) from a native dll which is
responsible in returning DNS servers address.

public class DNSQuery
{
[DllImport("GetD NSDLL.dll")]
public static extern IntPtr _GetDNSServers( );
public void PerformSomeActi ons()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime. InteropServices .Marshal.Copy(_ GetDNSServers() , buffer,0,
1000);
. . .
string strt=System.Tex t.Encoding.ASCI I.GetString(buf fer,0,1000);
strt= strt.Split(';')[0];
this.DNSHost=Sy stem.Net.Dns.Ge tHostByAddress( strt).AddressLi st[0];
IPEndPoint ipendp=new IPEndPoint(DNSH ost, 53);
sock.Connect(ip endp);
// ??????????????? ?An Error will happened!!!
sock = new
Socket(AddressF amily.InterNetw ork,socketType. Stream,Protocol Type.Tcp);
//??????????????? ??An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.Executi onEngineExcepti on' occurred in
system.dll

When I do not use _GetDNSServers( ),I use a known server address, connection
is done.

_GetDNSServers( ) returns char * (a pointer to an array of chars(1 byte
perchar)) which contains all DNS servers address from that domain

How to avoid the problem?

Thks!



Nov 15 '05 #1
2 1527
dotnet.framewor k.interop is probably a better place to ask this. You'll want
to add in the C prototype of the function you're trying to call.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
"viorel" <vm*********@ho tmail.com> wrote in message
news:Og******** ******@TK2MSFTN GP10.phx.gbl...
Greeting All!

Is some one who can help me?

The problem is when I use a func(_GetDNSSer vers) from a native dll which is responsible in returning DNS servers address.

public class DNSQuery
{
[DllImport("GetD NSDLL.dll")]
public static extern IntPtr _GetDNSServers( );
public void PerformSomeActi ons()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime. InteropServices .Marshal.Copy(_ GetDNSServers() , buffer,0, 1000);
. . .
string strt=System.Tex t.Encoding.ASCI I.GetString(buf fer,0,1000);
strt= strt.Split(';')[0];
this.DNSHost=Sy stem.Net.Dns.Ge tHostByAddress( strt).AddressLi st[0];
IPEndPoint ipendp=new IPEndPoint(DNSH ost, 53);
sock.Connect(ip endp);
// ??????????????? ?An Error will happened!!!
sock = new
Socket(AddressF amily.InterNetw ork,socketType. Stream,Protocol Type.Tcp);
//??????????????? ??An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.Executi onEngineExcepti on' occurred in system.dll

When I do not use _GetDNSServers( ),I use a known server address, connection is done.

_GetDNSServers( ) returns char * (a pointer to an array of chars(1 byte
perchar)) which contains all DNS servers address from that domain

How to avoid the problem?

Thks!


Nov 15 '05 #2
dotnet.framewor k.interop is probably a better place to ask this. You'll want
to add in the C prototype of the function you're trying to call.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
"viorel" <vm*********@ho tmail.com> wrote in message
news:Og******** ******@TK2MSFTN GP10.phx.gbl...
Greeting All!

Is some one who can help me?

The problem is when I use a func(_GetDNSSer vers) from a native dll which is responsible in returning DNS servers address.

public class DNSQuery
{
[DllImport("GetD NSDLL.dll")]
public static extern IntPtr _GetDNSServers( );
public void PerformSomeActi ons()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime. InteropServices .Marshal.Copy(_ GetDNSServers() , buffer,0, 1000);
. . .
string strt=System.Tex t.Encoding.ASCI I.GetString(buf fer,0,1000);
strt= strt.Split(';')[0];
this.DNSHost=Sy stem.Net.Dns.Ge tHostByAddress( strt).AddressLi st[0];
IPEndPoint ipendp=new IPEndPoint(DNSH ost, 53);
sock.Connect(ip endp);
// ??????????????? ?An Error will happened!!!
sock = new
Socket(AddressF amily.InterNetw ork,socketType. Stream,Protocol Type.Tcp);
//??????????????? ??An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.Executi onEngineExcepti on' occurred in system.dll

When I do not use _GetDNSServers( ),I use a known server address, connection is done.

_GetDNSServers( ) returns char * (a pointer to an array of chars(1 byte
perchar)) which contains all DNS servers address from that domain

How to avoid the problem?

Thks!


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2024
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
6
2358
by: Andrew Mueller | last post by:
Hello all, There is a message below 'Application Error... When querying data'. What appears to be happening is that when I perform a lot of queries in a row and bring back the information into a DataSet, the application will crash. It will not crash every time, though. It has a problem writing to certain memory locations, is what the error states...
2
1149
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
2
289
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or
169
9217
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide untaking to create a toolchain for it. Way back when, there used to be something called "Small C". I wonder if the creator(s) of that would want to embark on creating a nice little Small C++ compiler devoid of C++ language features that make...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.