Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-13-2009, 11:02 PM   #1
Registered: Aug 2008
Posts: 62

Rep: Reputation: 15
sendto: Invalid argument netbsd

hi all,
I've a program which worked on linux, but after porting on netbsd I take this error..
sent=sendto(sock, buf, buf_siz, 0, (struct sockaddr *) &sin, sizeof(sin));
I did verifying of values which's take function sendto, but they allright.
sent receive -1
Old 02-14-2009, 12:57 AM   #2
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 178Reputation: 178
Immediately after the call to sendto(), what's the value of errno?
Old 02-14-2009, 01:59 AM   #3
LQ Newbie
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
Originally Posted by wje_lq View Post
Immediately after the call to sendto(), what's the value of errno?
sendto() return -1
Old 02-14-2009, 03:29 AM   #4
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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:

'Hope that helps .. PSM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help me : Sendto: Invalid argument PF_PACKET SOCK_DGRAM htons(ETH_P_IP) tuxtuxtux Linux - Networking 3 03-24-2010 07:08 AM
message sending failed : Error[22 ] invalid argument .....but each and every argument rakeshranjanjha Linux - Software 2 01-08-2008 12:22 AM
iptables: Invalid argument pk_kala Linux - Server 4 06-23-2007 03:21 AM
sendto: invalid argument Yury Programming 12 11-04-2006 07:06 AM
alsamixer invalid argument subaruwrx Linux - Software 1 03-12-2005 02:34 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration