Hmmm... I can't find a problem in your code at the first look. Maybe the problem is an old anet.dll or anet.h? Have you downloaded the latest demo or are you using an old one.
The latest demo can be found here (this is a public beta test):
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=313200&page=2 (fourth entry on this page).