netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huajun Li <huajun.li.lee@gmail.com>
To: ZHOU Xiaobo <xb.zhou@qq.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: write() udp socket
Date: Sun, 24 Jul 2011 16:33:10 +0800	[thread overview]
Message-ID: <CA+v9cxZAF27mXc6aCEPyOdqbeLved3_xibvDS4TQugHR=7owPg@mail.gmail.com> (raw)
In-Reply-To: <tencent_287F494544728EDB6DA9C8ED@qq.com>

2011/7/23 ZHOU Xiaobo <xb.zhou@qq.com>:
> question No1:
> When I call
> ssize_t write(int fd, const void *buf, size_t count);
>
>
> on a nonblocking UDP socket, is the return value  always equal to 'count'?
>
>

I don't think so.  The function may be interrupt by signal or return
due to other reason, so the return value only represents the size it
writes successfully to the fd.

> question No2:
> Can I write() a UDP socket in multiple threads without locking?
>

In my opinion, you could. However, the receiver may not get what you expected.
>
> thanks
>
>
> ------------------
> Sincerely yours
>                         ZHOU Xiaobo

  reply	other threads:[~2011-07-24  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-23  9:29 write() udp socket ZHOU Xiaobo
2011-07-24  8:33 ` Huajun Li [this message]
2011-07-25 17:38   ` Rick Jones
  -- strict thread matches above, loose matches on Subject: below --
2011-07-26  5:32 ZHOU Xiaobo
2011-07-26  5:39 ZHOU Xiaobo

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='CA+v9cxZAF27mXc6aCEPyOdqbeLved3_xibvDS4TQugHR=7owPg@mail.gmail.com' \
    --to=huajun.li.lee@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xb.zhou@qq.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).