Are you removing just the `res =` or the whole line?  I meant you could remove the `res =` and leave the `connect`.

Looks like connect returns a `Rex::Socket::Tcp`, but you don't need to capture it since the [`Msf::Exploit::Remote::Tcp#connect`](https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/exploit/tcp.rb#L86) sets the returned `Rex::Socket::Tcp` to [`Msf::Exploit::Remote::Tcp#sock`](https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/exploit/tcp.rb#L117) and `self.sock` is used as the default socket for all the `raw_send_recv` calls.