[Haskell-cafe] Re: Low-level networking [Haskell not ready for Foo]

Jeff Zaroyko jeffzaroyko at gmail.com
Fri Jan 9 20:02:17 EST 2009


On Sat, Jan 10, 2009 at 5:20 AM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Dominic Steinitz wrote:
>>
>> John Goerzen <jgoerzen <at> complete.org> writes:
>>
>>>>
>>>> Any idea how I get Haskell to send ICMP ECHO packets? (And, obviously,
>>>> receive the replies.)
>>>>
>>>
>>> SocketType claims to support Raw, which I think is the conventional
>>> means for doing this.  Whether all the infrastructure for that is there,
>>> I don't know.  I have never worked with raw sockets though, so I may be
>>> leading you down a dark mugger-laden alley here
>>
>> Here's an example of a Haskell version of ping, now sadly bit-rotted.
>>
>> Dominic.
>>
>> http://haskell.org/networktools/src/ping/test.hs
>>
>
> I have a worrying feeling this might be too Unix-specific to work on
> Windows. But I guess it's a start...
>

If you want to "ping" on windows, you need to use IcmpCreateFile,
IcmpSendEcho, IcmpCloseFile for IPv4 or for IPv6, use the
Icmp6CreateFile, Icmp6SendEcho2, and Icmp6ParseReplies which are part
of iphlpapi, should be fairly trivial to use the loadLibrary and
getProcAddress functions from System.Win32.DLL  module to access
these.

-Jeff


More information about the Haskell-Cafe mailing list