Project

General

Profile

Actions

Bug #18792

closed

Socket.tcp throws `getaddrinfo': no implicit conversion of Hash into String

Added by rahulroot (Rahul Gupta) over 2 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]
[ruby-core:108635]

Description

Hello,

I was using ruby 2.5.3 for a while, but now it's EOL, trying to port my code to ruby 3.0.4.
Same piece of code is throwing error on below code snippet.

Below piece of code works fine on ruby 2.5.3, but throws error on ruby 3.0.4.
I investigated socket.rb, it turns out that local_host is Hash in latest ruby, in older version it was NilClass.

I have a sample running application on local VM.

require 'socket'

host = "192.168.56.100"
port = 8081
socket_opts = {
   connect_timeout: 10,
}

Socket.tcp(host, port, socket_opts)

Actions

Also available in: Atom PDF

Like0
Like0Like0