From: Marco Trudel <mtrudel@gmx.ch>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] rfcomm question 3
Date: Sat, 05 Feb 2005 18:39:04 +0100 [thread overview]
Message-ID: <420504B8.1090903@gmx.ch> (raw)
In-Reply-To: <1107612892.6921.152.camel@pegasus>
Hello Marcel
thanks a lot for your comments and hints on my code.
unfortunately we only had 1 module about c/c++ programming in the
university and I'm programming java for over 3 years.
Luckily, in comunication-technology, we've a subtopic about c
socket-programming in two weeks, this will be very helpfull.
Actually my project is in c++. Because of that I started already with the
c++ usage of comments and variable declarations. For c I usually use the
--ansii flag to ensure gcc backward compatibility.
I'll definitely check out the rctest.c example
Regarding your price/hour: Do you know how many money you would earn if you
got paid for your email support in this list? Amazing! :-)
It's always a pleasure if someone answers emails in mailinglists that fast
and precise as you do (The last one i've "met" spending so much time for a
mailinglist was Mattia Barbon in the wxPerl list.).
regards
Marco
Marcel Holtmann wrote:
> Hi Marco,
>
>
>>Thanks a lot. I hoped someone more c experienced will take a quick look at
>>my code. It's the result of a example I found (the mistake comes from
>>there) and a socket programming howto I read.
>>
>>I now changed it to
>>addr.rc_channel = 4;
>>
>>Actually I do not need to #define it for the whole file.
>
>
> the code is fine so far. However the best example is still in rctest.c
> besides that it uses fork() and this is sometimes hard to understand by
> beginners. I cleaned the rctest.c stuff lately and removed some cruft
> things.
>
> In your code I would only criticize the coding style and the naming of
> the variables.
>
> Coding style:
> - Use /* */ for comments
> - if(bind...) ==> if (bind...) {
> - (struct sockaddr *)&addr ==> (struct sockaddr *) &addr
>
> Variable names:
> - sock ==> sk
> - client ==> nsk (stands for new socket)
> - noReadChars ==> len or num (this is not C++ or Java)
>
> When you do accept() you should do the "alen = sizeof(addr);" again,
> because the value of alen could be overwritten. And a memset() of the
> addr variable before filling it with values is a good idea. It can
> happens that the size between the kernel and the userspace differs and
> so you make sure that it is filled with zeros.
>
> And don't declare new variables inside the code. Do it at the top of a
> function or a the top of a block. Old compilers like GCC 2.95 don't like
> this and remember this is not Java.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> Bluez-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
next prev parent reply other threads:[~2005-02-05 17:39 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-28 14:06 [Bluez-users] rfcomm question 1 Ka Kin Cheung
2005-01-28 17:36 ` Marcel Holtmann
2005-01-29 5:32 ` Ka Kin Cheung
2005-01-29 14:03 ` Marcel Holtmann
2005-01-31 13:41 ` Ka Kin Cheung
2005-01-31 14:22 ` Marcel Holtmann
2005-01-31 14:30 ` Ka Kin Cheung
2005-01-31 14:38 ` Marcel Holtmann
2005-02-01 6:25 ` [Bluez-users] rfcomm question 3 Ka Kin Cheung
2005-02-01 8:14 ` Marcel Holtmann
2005-02-01 14:39 ` Ka Kin Cheung
2005-02-02 2:49 ` Ka Kin Cheung
2005-02-02 3:10 ` Marcel Holtmann
2005-02-02 4:54 ` Ka Kin Cheung
2005-02-02 5:34 ` Marcel Holtmann
2005-02-03 3:42 ` Ka Kin Cheung
2005-02-03 5:22 ` Alain Volmat
2005-02-03 10:50 ` Ka Kin Cheung
2005-02-03 10:59 ` Alain Volmat
2005-02-03 13:01 ` Ka Kin Cheung
2005-02-03 13:20 ` Marcel Holtmann
2005-02-03 14:26 ` Ka Kin Cheung
2005-02-03 14:54 ` Marcel Holtmann
2005-02-04 16:56 ` Marco Trudel
2005-02-05 12:48 ` Ka Kin Cheung
2005-02-05 13:17 ` Marco Trudel
2005-02-05 13:51 ` Marcel Holtmann
2005-02-05 14:00 ` Marco Trudel
2005-02-05 14:14 ` Marcel Holtmann
2005-02-05 17:39 ` Marco Trudel [this message]
2005-02-05 18:08 ` Marcel Holtmann
2005-02-17 5:37 ` Ka Kin Cheung
2005-02-17 6:28 ` Alain Volmat
2005-02-17 9:08 ` mike
2005-02-17 13:08 ` Marco Trudel
2005-02-17 13:54 ` Ka Kin Cheung
2005-02-17 14:10 ` Marco Trudel
2005-02-17 14:43 ` Ka Kin Cheung
2005-02-17 17:04 ` Marco Trudel
2005-02-18 3:28 ` Ka Kin Cheung
2005-02-19 6:49 ` Marco Trudel
2005-02-19 8:27 ` Ka Kin Cheung
2005-02-19 10:06 ` Marco Trudel
2005-02-19 13:45 ` Ka Kin Cheung
2005-02-18 3:33 ` Ka Kin Cheung
2005-02-18 7:51 ` [Bluez-users] multiple instances of OPUSH server Janice M. Ballesteros
2005-02-17 13:14 ` [Bluez-users] rfcomm question 3 Marco Trudel
2005-02-02 3:16 ` Alain Volmat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=420504B8.1090903@gmx.ch \
--to=mtrudel@gmx.ch \
--cc=bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.