[Mono-dev] UdpClient.Receive returns invalid IPv6 address.

lost lostfreeman at gmail.com
Fri Apr 2 09:13:23 EDT 2010


I'm using Debian 5 with Mono from backports.org
I have simple reply application written in F#:

open System
open System.Net
open System.Net.Sockets
open System.Text

let args = Environment.GetCommandLineArgs()
let reply (ep: IPEndPoint) =
    use udp = new UdpClient(ep)
    let mutable src = null
    for i in 1 .. 10 do
        let data = udp.Receive(&src)
        printfn "in from %A %d" src.Address src.Port
        let str = Encoding.Default.GetString(data)
        let data = Encoding.Default.GetBytes("Hello, " + str)
        udp.Send(data, data.Length, src) |> ignore

let addr = IPAddress.Parse(args.[1])
let port = Int32.Parse(args.[2])
let ep = IPEndPoint(addr, port)
printfn "listening %A %d" addr port

reply ep

I'm running it on [2001:470:9928::370:1]:1701. I send a datagram to it
from the same IP. Here's the output:
listening 2001:470:9928::370:1 1701
in from 2001:470:9928::2100:0%-1210179184 35724

As you can see, IP address is broken (should be 2001:470:9928::370:1
again). So, reply is not sent correctly.
SSH works over IPv6 and displays correct address.
The same application works very fine under .NET on Windows host.

I've tested Mono 1.9.x.x from official repositories also. But it have
the same problem.

More information about the Mono-devel-list mailing list