M
Milosz - [playseven.com]
Hello,
I perform a ping using the IcmpSendEcho Function from iphlpapi:
<DllImport("iphlpapi")> _
Private Shared Function IcmpSendEcho(ByVal IcmpHandle As IntPtr, ByVal
DestinationAddress As System.UInt32, ByVal RequestData() As Byte, ByVal
RequestSize As Integer, ByVal RequestOptions As IntPtr, ByVal ReplyBuffer()
As Byte, ByVal ReplySize As Int32, ByVal Timeout As Int32) As System.UInt32
This Function requires a Destination Adress as an unsigned Int32. I get it
from the IPAddress.Address Object.
Public Structure PingOptions
Dim IPAdress As IPAddress
Dim TimeOUT As Integer
End Structure
dim opt as PingOptions
opt.IPAdress = IPAddress.Parse("192.168.1.128") ' Adresses bigger then
A.B.C.127, have a negative adress value !!!
ipaddr = System.UInt32.Parse(opt.IPAdress.Address) ' and couse exception
here
Dim ret As System.UInt32
'but i need an unsigned int here in the second parameter
ret = IcmpSendEcho(h, opt.ipaddr, RequestData, CInt(RequestData.Length),
IntPtr.Zero, reply._Data, reply._Data.Length, opt.TimeOUT)
The Problem is that for IPAdresses, where the last Byte is bigger then 127.
the generated Long Value for Adress is negative and the Parse Method to the
uint32 couses an exception.
Or should i declare the DestinationAdress as Long in the IcmpSendEcho and
put in IPAdress.Address value directly.
My assumption is that the Address value is created in the correct bitformat
but becouse the CF is declaring it as a long it is interpreted negative.
Or how else to get the correct Long Value from IPAdress.Address ?
THX in advance
--
-> Milosz Weckowski
www.playseven.com
mailto:[email protected]
ICQ Number: 84867613
Get the enhanced Progressbar and a fine Colorpicker for the Compact Framwork
for free:
http://www.playseven.com/11620/p7_Controls.html
I perform a ping using the IcmpSendEcho Function from iphlpapi:
<DllImport("iphlpapi")> _
Private Shared Function IcmpSendEcho(ByVal IcmpHandle As IntPtr, ByVal
DestinationAddress As System.UInt32, ByVal RequestData() As Byte, ByVal
RequestSize As Integer, ByVal RequestOptions As IntPtr, ByVal ReplyBuffer()
As Byte, ByVal ReplySize As Int32, ByVal Timeout As Int32) As System.UInt32
This Function requires a Destination Adress as an unsigned Int32. I get it
from the IPAddress.Address Object.
Public Structure PingOptions
Dim IPAdress As IPAddress
Dim TimeOUT As Integer
End Structure
dim opt as PingOptions
opt.IPAdress = IPAddress.Parse("192.168.1.128") ' Adresses bigger then
A.B.C.127, have a negative adress value !!!
ipaddr = System.UInt32.Parse(opt.IPAdress.Address) ' and couse exception
here
Dim ret As System.UInt32
'but i need an unsigned int here in the second parameter
ret = IcmpSendEcho(h, opt.ipaddr, RequestData, CInt(RequestData.Length),
IntPtr.Zero, reply._Data, reply._Data.Length, opt.TimeOUT)
The Problem is that for IPAdresses, where the last Byte is bigger then 127.
the generated Long Value for Adress is negative and the Parse Method to the
uint32 couses an exception.
Or should i declare the DestinationAdress as Long in the IcmpSendEcho and
put in IPAdress.Address value directly.
My assumption is that the Address value is created in the correct bitformat
but becouse the CF is declaring it as a long it is interpreted negative.
Or how else to get the correct Long Value from IPAdress.Address ?
THX in advance
--
-> Milosz Weckowski
www.playseven.com
mailto:[email protected]
ICQ Number: 84867613
Get the enhanced Progressbar and a fine Colorpicker for the Compact Framwork
for free:
http://www.playseven.com/11620/p7_Controls.html