LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 02-13-2009, 10:02 PM   #1
quantt
Member
 
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..
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
 
Old 02-13-2009, 11:57 PM   #2
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 809

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

Rep: Reputation: 0
Quote:
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, 02:29 AM   #4
paulsm4
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:

http://www.developerweb.net/forum/showthread.php?t=5754

'Hope that helps .. PSM
 
  


Reply


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 06:08 AM
message sending failed : Error[22 ] invalid argument .....but each and every argument rakeshranjanjha Linux - Software 2 01-07-2008 11:22 PM
iptables: Invalid argument pk_kala Linux - Server 4 06-23-2007 02:21 AM
sendto: invalid argument Yury Programming 12 11-04-2006 06:06 AM
alsamixer invalid argument subaruwrx Linux - Software 1 03-12-2005 01:34 PM


All times are GMT -5. The time now is 06:55 PM.

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