Re: recvfrom returns with an error code of 14, EFAULT "Bad Address"
From: Barry Margolin (barry.margolin_at_level3.com)
Date: 07/03/03
- Next message: Paul LAURENT: "Re: How to force a socket to close ?"
- Previous message: llewelly: "Re: gprof with C and C++ not working"
- In reply to: Chris Ritchey: "recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Next in thread: Chris Ritchey: "Re: recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Reply: Chris Ritchey: "Re: recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 03 Jul 2003 17:29:36 GMT
In article <480de79d.0307030820.7b959e89@posting.google.com>,
Chris Ritchey <rethnor@yahoo.com> wrote:
>I'll post the code at the bottom of the post. Whenever I try to
It looks like you didn't post the correct code, I don't see any calls to
recvfrom() in the excerpt.
>retreive a udp packet sent via broadcast I get the errorcode
>EFAULT(bad address). The same program sends out the packets without
Sounds like you passed an uninitialized pointer as the buffer argument
argument.
>any complaints but it fails when retreiving, I'm lost as to why it
>would report this error. It returns the number of bytes correctly but
If it returns the number of bytes, then how can it also be reporting an
error code? Errno is only meaningful if recvfrom() returns -1.
>returns the char* buffer as NULL. Any help would be appriciated and I
I don't understand this at all. Buffer is an input parameter, not an
output parameter. You have to pass in the pointer to the place where you
want the data written.
>wouldn't be supprised if I was just missing something simple with
>broacasting as I am still learning some aspects of socket
>programiing.Thanks in advance to all whom reply and here is the code:
Have you looked at the sample code in Unix Network Programming, Vol.1?
-- Barry Margolin, barry.margolin@level3.com Level(3), Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
- Next message: Paul LAURENT: "Re: How to force a socket to close ?"
- Previous message: llewelly: "Re: gprof with C and C++ not working"
- In reply to: Chris Ritchey: "recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Next in thread: Chris Ritchey: "Re: recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Reply: Chris Ritchey: "Re: recvfrom returns with an error code of 14, EFAULT "Bad Address""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|