IP release & renew

  • Thread starter Thread starter Matteo Gabella
  • Start date Start date
M

Matteo Gabella

hi all, i need to release and renew the IP address... (using VB.net)
so i look in the newsgroups, and everybody talking about a
AdapterInfo.zip file from www.alexfeinman.com, but the site is down...
so i'm asking: does enybody have information about the file? or any
other suggestions for me?
thank you very much...
matteo gabella
 
I don't have any P/Invoke code that shows it, but you basically need to call

DWORD IpReleaseAddress(
PIP_ADAPTER_INDEX_MAP AdapterInfo
);

or

DWORD IpRenewAddress(
PIP_ADAPTER_INDEX_MAP AdapterInfo
);

which I believe are both implemented in iphlpapi.dll. The structure that
each call accepts as a parameter is not terribly complicated. You can use
the OpenNETCF.Net namespace tools to get the adapter names and, I believe,
indices.

Paul T.
 
It's not down, but it looks like there was some sort of routing problem (not
on my end) - other people reported trouble sending mail to me. Try again -
it's definitely up.
 
I'm completely stuck in IP APIs...
What I'm doing wrong? I create a patchwork of code, getting stuff from
NGs, MSDN, wizards, holy spirits, but... the only thing I obtain is
"System.NotSupportedException"

I want only to fill that IP_INTERFACE_INFO structure to feed the
IpReleaseAddress API...

Uff.. any help?

Thanks
Matteo Gabella
-----------------------

Public Structure IP_ADAPTER_INDEX_MAP
Public Index As Integer
Public Name As String
End Structure

Public Structure IP_INTERFACE_INFO
Public NumAdapters As Integer
Public Adapter As IP_ADAPTER_INDEX_MAP
End Structure

Declare Function GetInterfaceInfo Lib "Iphlpapi" (ByRef PIfTableBuffer
As IP_INTERFACE_INFO, ByRef dwOutBufLen As Long) As Long

Dim x As IP_INTERFACE_INFO
Dim a As Long = GetInterfaceInfo(x, 0)

-----------------------
 
I'm confused as to why you are trying to call that function. If all you
want to do is release the current IP, you don't need to call
GetInterfaceInfo. You will need to know the index of the adapter and its
name, but you can use OpenNETCF.Net to get that information without writing
any more code:

AdapterCollection ac = OpenNETCF.Net.Networking.GetAdapters();

// Find the adapter in the list that you want to work with somehow
(for..each or
// whatever.
Adapter a = ????;
int indexForIpRenewAddress = a.Index;
String nameForIpRenewAddress = a.Name;

// Continue to plug the index and name into the structure and call
IpRenewAddress.

Paul T.
 
thank you... i'll try...
i'm quite suspicious about OpenNETCF.org... because it’s free, and free stuff always hide something bad...
but now I want to trust you... and I want to join the family...
I’ll give you my feedback
Bye and thanks again
Matteo gabella


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Ha, ha! Well, it's virtually all code that we wrote because we needed it.
You have the source, so you can use the binaries or the complete class
libraries a little or a lot, depending on your needs. I have yet to think
of a downside for anyone developing applications for Windows CE devices...

Paul T.
 
If it would make you feel better, you can always send us a check....

:)

-Chris


matteo said:
thank you... i'll try...
i'm quite suspicious about OpenNETCF.org... because it's free, and free
stuff always hide something bad...
but now I want to trust you... and I want to join the family...
I'll give you my feedback
Bye and thanks again
Matteo gabella


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
OpenNETCF.Net.Networking.GetAdapters doesn't work on my device
(intermec 700 mono)... but only on the emulator...

(I would have to propose the emulator to my customers... ;-) )

well thanks however for your work,
tomorrow i'll try on intermec 700 color... and then i'll wait for any
patch

bye!
matteo gabella
 
Maybe you could be a little more specific? If it doesn't work, I'm at a
loss to explain how it could have network connectivity at all. What version
of Windows CE is it running? You've tried the latest version of the
OpenNETCF code?

Paul T.
 
here's my data....
tnks

device: Intermec 700 (mono) / Intermec 700C (color)

OS: PocketPC 2002 (Version 3.0.11171)

openNETCF.net: 1.2.3346.0

solution: references: OpenNETCF.Net

code: Imports OpenNETCF.Net
 
sh.. i didn't realize: device is ppc2002, emulator is ppc2003...

is this the answer?

MG
 
Ah! I just fixed that problem in the source code this week. The next
OpenNETCF release should have it fixed. If you are using the source code
version, you can fix it yourself by adding the lines marked with !!!! to the
code in FirstAdapter(), found near line 176 in Adapter.cs:

-----

// Reset the indexing.

firstnextIndex = 0;

if ( this.Next == 0 ) // !!!!

firstnextOffset = 0; // !!!!

else // !!!!

firstnextOffset = this.Next - ourBase;
 
Back
Top