0

I am playing with TCPSockets today and was using

@client_port, @client_addr = Socket.unpack_sockaddr_in(@socket.getpeername)

to get the client ip address and port. I've just proceeded to add SSL to the client and server but that now means

@socket.getpeername

is unsupported (as mentioned in https://bugs.ruby-lang.org/issues/8126). Is there another method I can use to get this information? I've googled around for a while but haven't been able to find anything of use.

iwasinnamuknow
  • 303
  • 1
  • 2
  • 10

1 Answers1

0

Just discovered from rubysrc/sample/openssl/echo-svr.rb that

@socket.peeraddr

is available to SSLSocket and provides all the required information.

iwasinnamuknow
  • 303
  • 1
  • 2
  • 10