How to get peeraddr

Hi. How can I get peeraddr (client hostname and ipaddress) in a simple
server like the following? Thanks.

#!/usr/bin/ruby --debug
require ‘soap/rpc/standaloneServer’
PS = ‘passphrase’
class MyClass

end
class Server < SOAP::RPC::StandaloneServer
def on_init
Pq = MyClass.new

end
end
svr = Server.new(‘Pq’, PS, ‘0.0.0.0’, 4241)
trap(‘INT’) { svr.shutdown }
svr.start

Or, how can I enable WEBrick debug level logging? Now I see INFO
messages only. Thank you for your help.

Joy W. wrote:

Hi. How can I get peeraddr (client hostname and ipaddress) in a simple
server like the following? Thanks.

#!/usr/bin/ruby --debug
require ‘soap/rpc/standaloneServer’
PS = ‘passphrase’
class MyClass

end
class Server < SOAP::RPC::StandaloneServer
def on_init
Pq = MyClass.new

end
end
svr = Server.new(‘Pq’, PS, ‘0.0.0.0’, 4241)
trap(‘INT’) { svr.shutdown }
svr.start

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs