LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   sendto: Invalid argument netbsd (https://www.linuxquestions.org/questions/programming-9/sendto-invalid-argument-netbsd-704548/)

quantt 02-13-2009 10:02 PM

sendto: Invalid argument netbsd
 
hi all,
I've a program which worked on linux, but after porting on netbsd I take this error..
Code:

sent=sendto(sock, buf, buf_siz, 0, (struct sockaddr *) &sin, sizeof(sin));
why?
I did verifying of values which's take function sendto, but they allright.
sent receive -1

wje_lq 02-13-2009 11:57 PM

Immediately after the call to sendto(), what's the value of errno?

synoptyck 02-14-2009 12:59 AM

Quote:

Originally Posted by wje_lq (Post 3442982)
Immediately after the call to sendto(), what's the value of errno?

sendto() return -1

paulsm4 02-14-2009 02:29 AM

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


All times are GMT -5. The time now is 05:25 PM.