I didn't find any length field of the hostname (wDataLength is always 0; dunno why) that's why I used a constant value. 
I will set it to 255 as specified in the wiki hostname restriction link. Thank you