The sending in the code you posted works. So your problem lies elsewhere, for example when id is 0 your function hangs forever in the first loop. But there is another problem. You seem to send the skill not only once but permanently in a loop to the server. This is not the reason why it does not work, but its very bad for the traffic. You send in reliable mode, so you need to send it only once. If your function does not work the first time, permanently repeating it wont make it better.