473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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(_GetDNSServers) from a native dll which is
responsible in returning DNS servers address.

public class DNSQuery
{
[DllImport("GetDNSDLL.dll")]
public static extern IntPtr _GetDNSServers();
public void PerformSomeActions()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime.InteropServices.Marshal.Copy(_GetDN SServers(), buffer,0,
1000);
. . .
string strt=System.Text.Encoding.ASCII.GetString(buffer,0 ,1000);
strt= strt.Split(';')[0];
this.DNSHost=System.Net.Dns.GetHostByAddress(strt) .AddressList[0];
IPEndPoint ipendp=new IPEndPoint(DNSHost, 53);
sock.Connect(ipendp);
// ????????????????An Error will happened!!!
sock = new
Socket(AddressFamily.InterNetwork,socketType.Strea m,ProtocolType.Tcp);
//?????????????????An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.ExecutionEngineException' 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 1514
dotnet.framework.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*********@hotmail.com> wrote in message
news:Og**************@TK2MSFTNGP10.phx.gbl...
Greeting All!

Is some one who can help me?

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

public class DNSQuery
{
[DllImport("GetDNSDLL.dll")]
public static extern IntPtr _GetDNSServers();
public void PerformSomeActions()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime.InteropServices.Marshal.Copy(_GetDN SServers(), buffer,0, 1000);
. . .
string strt=System.Text.Encoding.ASCII.GetString(buffer,0 ,1000);
strt= strt.Split(';')[0];
this.DNSHost=System.Net.Dns.GetHostByAddress(strt) .AddressList[0];
IPEndPoint ipendp=new IPEndPoint(DNSHost, 53);
sock.Connect(ipendp);
// ????????????????An Error will happened!!!
sock = new
Socket(AddressFamily.InterNetwork,socketType.Strea m,ProtocolType.Tcp);
//?????????????????An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.ExecutionEngineException' 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.framework.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*********@hotmail.com> wrote in message
news:Og**************@TK2MSFTNGP10.phx.gbl...
Greeting All!

Is some one who can help me?

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

public class DNSQuery
{
[DllImport("GetDNSDLL.dll")]
public static extern IntPtr _GetDNSServers();
public void PerformSomeActions()
{
. . .
byte[]buffer=new byte[1000];
System.Runtime.InteropServices.Marshal.Copy(_GetDN SServers(), buffer,0, 1000);
. . .
string strt=System.Text.Encoding.ASCII.GetString(buffer,0 ,1000);
strt= strt.Split(';')[0];
this.DNSHost=System.Net.Dns.GetHostByAddress(strt) .AddressList[0];
IPEndPoint ipendp=new IPEndPoint(DNSHost, 53);
sock.Connect(ipendp);
// ????????????????An Error will happened!!!
sock = new
Socket(AddressFamily.InterNetwork,socketType.Strea m,ProtocolType.Tcp);
//?????????????????An Error has been!!!
. . .
}
}
Message of exception is
An unhandled exception of type 'System.ExecutionEngineException' 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
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...
6
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...
2
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...
2
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...
169
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.