Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

accept error

0 views
Skip to first unread message

asit

unread,
Oct 7, 2008, 10:00:21 AM10/7/08
to
why accept function gives error ?

I have done the following steps..

created socket
bound the socket
socket listens
socket accept..(here it returns always -1)

Martin Vuille

unread,
Oct 7, 2008, 10:22:59 AM10/7/08
to
asit <lip...@gmail.com> wrote in news:34ac6a6f-0861-4bfd-8cf6-
15a383...@a2g2000prm.googlegroups.com:

On failure, accept sets errno to indicate the reason for
the failure. What is the value returned in errno?

MV

--
I do not want replies; please follow-up to the group.

asit

unread,
Oct 7, 2008, 10:36:38 AM10/7/08
to
On Oct 7, 7:22 pm, Martin Vuille <jpm...@yahoo.com> wrote:
> asit <lipu...@gmail.com> wrote in news:34ac6a6f-0861-4bfd-8cf6-
> 15a3831b1...@a2g2000prm.googlegroups.com:

>
> > why accept function gives error ?
>
> > I have done the following steps..
>
> > created socket
> > bound the socket
> > socket listens
> > socket accept..(here it returns always -1)
>
> On failure, accept sets errno to indicate the reason for
> the failure. What is the value returned in errno?
>
> MV
>
> --
> I do not want replies; please follow-up to the group.

how to retrive errorno ???

Martin Vuille

unread,
Oct 7, 2008, 10:47:19 AM10/7/08
to
asit <lip...@gmail.com> wrote in news:81943ffe-fe09-45e0-82a6-
358840...@40g2000prx.googlegroups.com:

>>
>> On failure, accept sets errno to indicate the reason for
>> the failure. What is the value returned in errno?
>>
>

> how to retrive errorno ???
>

Note: it's "errno", not "errorno"

Try "man errno"
You might also want to try "man perror" and "man accept"

asit

unread,
Oct 7, 2008, 11:39:03 AM10/7/08
to
On Oct 7, 7:47 pm, Martin Vuille <jpm...@yahoo.com> wrote:
> asit <lipu...@gmail.com> wrote in news:81943ffe-fe09-45e0-82a6-
> 35884046d...@40g2000prx.googlegroups.com:

>
>
>
> >> On failure, accept sets errno to indicate the reason for
> >> the failure. What is the value returned in errno?
>
> > how to retrive errorno ???
>
> Note: it's "errno", not "errorno"
>
> Try "man errno"
> You might also want to try "man perror" and "man accept"
>
> MV
>
> --
> I do not want replies; please follow-up to the group.

I found it.....
#include <error.h>

printf("%d",errno);

vipp...@gmail.com

unread,
Oct 7, 2008, 11:41:32 AM10/7/08
to
On Oct 7, 6:39 pm, asit <lipu...@gmail.com> wrote:
> On Oct 7, 7:47 pm, Martin Vuille <jpm...@yahoo.com> wrote:
>
>
>
> > asit <lipu...@gmail.com> wrote in news:81943ffe-fe09-45e0-82a6-
> > 35884046d...@40g2000prx.googlegroups.com:
>
> > >> On failure, accept sets errno to indicate the reason for
> > >> the failure. What is the value returned in errno?
>
> > > how to retrive errorno ???
>
> > Note: it's "errno", not "errorno"
>
> > Try "man errno"
> > You might also want to try "man perror" and "man accept"
>
> I found it.....
> #include <error.h>
>
> printf("%d",errno);

Please don't quote sig blocks.
Read your documentation with more care.
It's <errno.h>, not <error.h>.

Martin Vuille

unread,
Oct 7, 2008, 1:25:42 PM10/7/08
to
asit <lip...@gmail.com> wrote in news:48e4638c-8eaf-48ca-8ff5-
e05678...@w24g2000prd.googlegroups.com:

>
> I found it.....
> #include <error.h>
>
> printf("%d",errno);

That will work. But likely your next question will be:
"what does error code XX mean?"

If you use perror(), it will print out a text string
corresponding to the error, and that should make it
easier for you to figure out what is going wrong.

asit

unread,
Oct 7, 2008, 2:18:18 PM10/7/08
to
On Oct 7, 10:25 pm, Martin Vuille <jpm...@yahoo.com> wrote:
> asit <lipu...@gmail.com> wrote in news:48e4638c-8eaf-48ca-8ff5-
> e05678da4...@w24g2000prd.googlegroups.com:

>
>
>
> > I found it.....
> > #include <error.h>
>
> > printf("%d",errno);
>
> That will work. But likely your next question will be:
> "what does error code XX mean?"
>
> If you use perror(), it will print out a text string
> corresponding to the error, and that should make it
> easier for you to figure out what is going wrong.
>
> MV
>
> --
> I do not want replies; please follow-up to the group.

Thanx..before than I was using google to understand the error code...

0 new messages