ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: akr@fsij.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:71517] [Ruby trunk - Bug #11701] [Open] recvmsg for UDP without argument
Date: Tue, 17 Nov 2015 08:19:15 +0000	[thread overview]
Message-ID: <redmine.issue-11701.20151117081915.0b354e2ef9eb824a@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11701.20151117081915@ruby-lang.org

Issue #11701 has been reported by Akira Tanaka.

----------------------------------------
Bug #11701: recvmsg for UDP without argument
https://bugs.ruby-lang.org/issues/11701

* Author: Akira Tanaka
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
It seems recvmsg without argument doesn't work well for UDP now.

Following example sends a packet which size is 10000 bytes but
receives a packet which size is 4096 bytes.

```
% ./ruby -rsocket -ve 's1 = Addrinfo.udp("127.0.0.1", 0).bind             
s2 = s1.connect_address.connect
s2.send("a"*10000, 0)
ret = s1.recvmsg
p ret[0].length
'
ruby 2.3.0dev (2015-11-17 trunk 52613) [x86_64-linux]
4096
```

ruby-2.3.0-preview1 worked well.
It receives a packet which size is 10000 bytes.

```
% ruby-2.3.0-preview1 -rsocket -ve 's1 = Addrinfo.udp("127.0.0.1", 0).bind
s2 = s1.connect_address.connect
s2.send("a"*10000, 0)
ret = s1.recvmsg
p ret[0].length
'
ruby 2.3.0preview1 (2015-11-11 trunk 52539) [x86_64-linux]
10000
```

This behavior (recvmsg without arguments) is documented as follows:

```
maxmesglen and maxcontrollen can
be nil. In that case, the buffer will be grown until the message is not
truncated. Internally, MSG_PEEK is used and MSG_TRUNC/MSG_CTRUNC are checked.
```




-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2015-11-17  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11701.20151117081915@ruby-lang.org>
2015-11-17  8:19 ` akr [this message]
2015-11-17 21:03   ` [ruby-core:71527] Re: [Ruby trunk - Bug #11701] [Open] recvmsg for UDP without argument Eric Wong

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-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-11701.20151117081915.0b354e2ef9eb824a@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).