[#114774] [Ruby master Feature#19884] Make Safe Navigation Operator work on classes — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>
Issue #19884 has been reported by p8 (Petrik de Heus).
13 messages
2023/09/15
[ruby-core:114912] [Ruby master Misc#19899] Ruby3.3.0-preview2: Behaviour changes of Socket.recv when the sever closes the connection
From:
"alanwu (Alan Wu) via ruby-core" <ruby-core@...>
Date:
2023-09-28 19:36:08 UTC
List:
ruby-core #114912
Issue #19899 has been updated by alanwu (Alan Wu).
Status changed from Open to Closed
NEWS entry added in commit:2e4e4c82c28. Thanks for the report!
----------------------------------------
Misc #19899: Ruby3.3.0-preview2: Behaviour changes of Socket.recv when the =
sever closes the connection
https://bugs.ruby-lang.org/issues/19899#change-104781
* Author: jbeschi (jacopo beschi)
* Status: Closed
* Priority: Normal
----------------------------------------
I noticed that `Socket#recv` now returns `nil` instead of `""` when the ser=
ver closes the connection, is it expected? If yes, I suggest mentioning it =
to the [release page](https://www.ruby-lang.org/en/news/2023/09/14/ruby-3-3=
-0-preview2-released/).=20
Example:
``` ruby
# server.rb
require "socket"
port =3D 3030
server =3D TCPServer.new("", port)
while(conn =3D server.accept) #serves forever
conn.print "hello"
conn.close
end
#=A0client.rb
require 'socket'
port =3D 3030
socket =3D TCPSocket.new("localhost", port)
2.times do
res =3D socket.recv(1012)
puts "received:"
p res
end
socket.close
```
```
jacopo-37s-mb 3.2.0 ~ ruby client.rb
received:
"hello"
received:
""
jacopo-37s-mb 3.2.0 ~ rbenv local 3.3.0-preview2
jacopo-37s-mb 3.3.0-preview2 ~ ruby client.rb
received:
"hello"
received:
nil
```
Thanks!
--=20
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-c=
ore.ml.ruby-lang.org/