pocketpc ping

pocketpc ping

Post by Alexander Reye » Sat, 05 Jul 2003 19:05:46



I want to use Ping, from the winapi from winCE 4.
But it produces an unvalid cast exception.

Here is my source:        (like in http://www.opennetcf.org/
Structure ip_option_information

Dim Ttl As Byte ' // Time To Live

Dim Tos As Byte ' // Type Of Service

Dim Flags As Byte ' // IP header flags

Dim OptionsSize As Byte ' // Size in bytes of options data

Dim OptionsData As Object ' // Pointer to options data

End Structure

Structure icmp_echo_reply

Dim Address As ipAddress ' // Replying address

Dim Status As UInt32 ' // Reply IP_STATUS

Dim RoundTripTime As UInt32 ' // RTT in milliseconds

Dim DataSize As UInt16 ' // Reply data size in bytes

Dim Reserved As UInt16 ' // Reserved for system use

Dim Data As Object ' // Pointer to the reply data

Dim Options As ip_option_information ' // Reply options

End Structure

_______________________

Dim buffer(4096) As Byte

Dim handle As IntPtr

Dim rdata(4096) As Buffer

Dim bclose As Boolean = False

Dim replysize As UInt64

Dim timeout As Object

Try

timeout = 500

handle = winap.IcmpCreateFile()

winap.IcmpSendEcho(handle, Me.ipAddress, CType(rdata, Object), rdata.Length,
Nothing, CType(buffer, Object), replysize, timeout)

bclose = winap.IcmpCloseHandle(handle)

________________________________________

Sendecho is defined like this:

#region ----------------Icmp API Calls-----------------------------

public void IcmpSendEcho(IntPtr IcmpHandle,

IPAddress DestinationAddress,

IntPtr RequestData,

long RequestSize, //Word

IntPtr RequestOptions, //PIP_OPTION_INFORMATION

IntPtr ReplyBuffer,

ulong ReplySize, //DWORD

ulong Timeout

)

{

IcmpSendEcho(

IcmpHandle,

DestinationAddress,

RequestData,

RequestSize, //Word

RequestOptions, //PIP_OPTION_INFORMATION

ReplyBuffer,

ReplySize, //DWORD

Timeout);

return ;

Quote:}

________________________________________

[DllImport("coredll")]

public static extern void IcmpSendEcho(

IntPtr IcmpHandle,

IPAddress DestinationAddress,

IntPtr RequestData,

long RequestSize, //Word

IntPtr RequestOptions, //PIP_OPTION_INFORMATION

IntPtr ReplyBuffer,

ulong ReplySize, //DWORD

ulong Timeout

);

 
 
 

1. How to Ping from PocketPC

I have tried using the icmp headers from the other devices in the Windows CE
development tools for the PocketPC with little success.  I am wondering if
anyone else has successfully used code from C++ to ping an IP.

The ICMP lib exists in the PocketPC lib directory, but the includes do not
contain the header files.

I have searched the web for solutions, but no one seems to post the details
of the solution, only allusions.

Any help is appreciated,
Michael Peters

2. Duration of a recuring task

3. Pinging in PocketPC

4. how to set socket options in IIS

5. PocketPC and Ping - SOCK_RAW support

6. Any in constructor

7. Can't ping name of PocketPC from the computer-Act.sync=guest

8. Whats the software to use 4 analog albums to cd?? tia

9. ping on pocketpc - icmpsendecho

10. Looking for a 'ping' or 'trace' program for PocketPC 2002.

11. can't install ping program or any pocket pc program

12. Ping and trace route

13. Ping Sweep