I'm receiving multicast UDP packets, which works fine, but I don't seem to be 
getting a valid address returned after I call asyncdispatch.recvFromInto.

Here's a fragment of my code:

> var
>     message = newString(1000) sock_address: SockAddr sock_address_len: SockLen
>     
> 
> while true:
>     
> 
> let length = await sock_fd.recvFromInto(
>     addr(message[0]), 1000, addr(sock_address), addr(sock_address_len)
> 
> )

A valid message is received, but the sock_address appears to be invalid when I 
later try to decode it using net.fromSockAddr or posix.getnameinfo. The 
sock_address_len is always zero.

I notice that down in the posix module the SockAddr structure is defined as:

SockAddr* {.importc: "struct sockaddr", header: "<sys/socket.h>",
    pure, final.} = object ## struct sockaddr
    sa_family*: TSa_Family ## Address family. sa_data*: array[0..255, char] ## 
Socket address (variable-length data).

I'm using FreeBSD which has an extra unsigned char called sa_len at the 
beginning of the struct. I don't know if this is contributing to the problem.

Reply via email to