All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] rctest.c : question about do_listen function
@ 2004-11-29 19:00 theresa g.
  2004-11-29 19:10 ` Lars Grunewaldt
  0 siblings, 1 reply; 3+ messages in thread
From: theresa g. @ 2004-11-29 19:00 UTC (permalink / raw)
  To: bluez-devel

hello everyone,

I have looked at the rctest.c file (inside the bluez-utils-2.11/test 
directory) to get insight on how to write my own server app.  It all makes 
sense, except for the listen() call inside the do_listen function, which 
follows:

	if( listen(s, 10) ) {
		syslog(LOG_ERR,"Can not listen on the socket. %s(%d)", strerror(errno), 
errno);
		exit(1);
	}

I'm somewhat of a newbie to all this stuff (including sockets) so I question 
why the listen return is being checked for a 1 for error when the man pages 
say -1 is returned on error and 0 is returned on success.

Insight to this would really be appreciated!

Thanks in advance,
Theresa




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez-devel] rctest.c : question about do_listen function
  2004-11-29 19:00 [Bluez-devel] rctest.c : question about do_listen function theresa g.
@ 2004-11-29 19:10 ` Lars Grunewaldt
  2004-11-30  0:46   ` theresa g.
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Grunewaldt @ 2004-11-29 19:10 UTC (permalink / raw)
  To: bluez-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|     if( listen(s, 10) ) {
|         syslog(LOG_ERR,"Can not listen on the socket. %s(%d)",
| strerror(errno), errno);
|         exit(1);
|     }
|
| I'm somewhat of a newbie to all this stuff (including sockets) so I
| question why the listen return is being checked for a 1 for error when
| the man pages say -1 is returned on error and 0 is returned on success.

If I'm not totally wrong, only "0" is treated as false, why all non-zero
values are treated as "true", so the comparison is true for -1...

greetings,
~  Lars
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBq3QvQWC6DTWkDAoRAgH6AJ497Ro9tyOh+VhCIli4T8kSo3IktQCgu9/r
Al2nU6MplBDnok1+NKzhj3M=
=z3q+
-----END PGP SIGNATURE-----


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez-devel] rctest.c : question about do_listen function
  2004-11-29 19:10 ` Lars Grunewaldt
@ 2004-11-30  0:46   ` theresa g.
  0 siblings, 0 replies; 3+ messages in thread
From: theresa g. @ 2004-11-30  0:46 UTC (permalink / raw)
  To: bluez-devel

hey thanks, i think you may be correct about that assumption.

theresa




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-30  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-29 19:00 [Bluez-devel] rctest.c : question about do_listen function theresa g.
2004-11-29 19:10 ` Lars Grunewaldt
2004-11-30  0:46   ` theresa g.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.