synoptyck -
Most socket functions just return "-1" on failure. You have to read the actual error from the global variable "errno" as a second step. That's what wje_lq was asking - a perfectly fair question.
But judging from the thread's title, the OP has already done this, and the value in errno is "EINVAL": invalid argument.
Quantt: you haven't posted enough code for us to really help you. We'd need more than just the "sendto()": we also need
a) the declarations for each of the parameters
b) where each parameter was last initialized
... and, yes ...
c) the value of "errno" (for example, EINVAL)
But please look at this thread: it might give you some hints:
http://www.developerweb.net/forum/showthread.php?t=5754
'Hope that helps .. PSM