Public Structure ip_option_information
Dim TTL As Byte
Dim Tos As Byte
Dim flags As Byte
Dim OptionsSize As Byte
Dim OptionsData As Long
End Structure
<DllImport("iphlpapi")> Private Shared Function IcmpSendEcho(ByVal
IcmpHandle As IntPtr, ByVal DestinationAddress As Integer, ByVal
RequestData() As Byte, ByVal RequestSize As Integer, ByVal RequestOptions As
ip_option_information, ByVal ReplyBuffer() As Byte, ByVal ReplySize As
Int32, ByVal Timeout As Int32) As System.UInt32
but how to put it in the function ?
.Net does not support pointers.
i am a little confused. should i havet to write a wrapper in C++ to do this
?
regards
--
-> Milosz Weckowski
www.playseven.com
mailto:m...@playseven.com
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
Dim _Data as new Byte(8)
Public Property Data as Byte()
Get
Return _Data
End Get
End Property
Public Property TTL as Byte
Get
Return _Data(0)
End Get
End Property
Public Property Tos as Byte
Get
Return _Data(1)
End Get
End Property
Public Property Flag as Byte
Get
Return _Data(2)
End Get
End Property
Public Property OptionSize as Byte
Get
Return _Data(3)
End Get
End Property
Public Property [Options] as IntPtr
Get
Return CType(BitConverter.ToInt32(_Data, 4), IntPtr)
End Get
End Property
Public Sub New(OptSize as Integer)
Dim pOpt as IntPtr = LocalAlloc(&H40, OptSize)
Data(3) = CType(OptSize, Byte)
BitConverter.GetBytes(pOpt.ToInt32()).Copy(_Data, 4, 4)
End Sub
Public Sub Dispose()
LocalFree([Options])
End Sub
End Class
Then pass IP_OPTIONS_INFORMATION.Data to the function
--
Alex Feinman
Coming to MDC? make sure to stop by the session CLI345
on Thursday for OpenNETCF talk
"Milosz - [playseven.com]" <m...@playseven.com> wrote in message
news:exe04ePD...@TK2MSFTNGP09.phx.gbl...
THX !
"Alex Feinman [MVP]" <publi...@alexfeinman.com> schrieb im Newsbeitrag
news:eHgDIuQD...@tk2msftngp13.phx.gbl...
Private Const LMEM_ZEROINIT As Integer = &H40
Private Const LMEM_FIXED As Integer = &H0
Private Const LPTR = (LMEM_FIXED Or LMEM_ZEROINIT)
.....
Dim OPPointer As IntPtr = IntPtr.Zero
If opt.TTL > 0 Then
Dim PingOpt As New ip_option_information
PingOpt.TTL = opt.TTL
OPPointer = LocalAlloc(LPTR, 12)
Marshal.StructureToPtr(PingOpt, OPPointer, True)
End If
Dim ret As System.UInt32
ret = IcmpSendEcho(h, ipaddr, RequestData, CInt(RequestData.Length),
OPPointer, reply._Data, reply._Data.Length, opt.TimeOUT)
Dim dwErr As Integer
....
LocalFree(...)
"Milosz - [playseven.com]" <m...@playseven.com> schrieb im Newsbeitrag
news:exe04ePD...@TK2MSFTNGP09.phx.gbl...