The problem is in your test program; you're calling inet_ntoa() twice in your printf() invocation, and the second call to inet_ntoa() overwrites the static buffer that's returned. louie