What is your compilation target? If it’s Eval (i.e. the Haxe interpreter), it’s normal that you get this exception. You must compile your code to C++, Java, Neko, PHP, etc.
See: sys.net.UdpSocket => Available on…
Note that this “available on” is actually bugged and shows more targets than are really available: Python UdpSocket · Issue #6933 · HaxeFoundation/haxe · GitHub
Thanks, i solved this problem, it works with neko