module SSLScan::Socket::Tcp
This class provides methods for interacting with a TCP client connection.
Public Class Methods
create(hash = {})
click to toggle source
Creates the client using the supplied hash.
@see create_param
@see SSLScan::Socket::Parameters.from_hash
# File lib/ssl_scan/socket/tcp.rb, line 23 def self.create(hash = {}) hash['Proto'] = 'tcp' self.create_param(SSLScan::Socket::Parameters.from_hash(hash)) end
create_param(param)
click to toggle source
Wrapper around the base socket class' creation method that automatically sets the parameter's protocol to TCP.
# File lib/ssl_scan/socket/tcp.rb, line 32 def self.create_param(param) param.proto = 'tcp' SSLScan::Socket.create_param(param) end
Public Instance Methods
localinfo()
click to toggle source
Returns local information (host + port) in host:port format.
# File lib/ssl_scan/socket/tcp.rb, line 65 def localinfo if (pi = getlocalname) return pi[1] + ':' + pi[2].to_s end end
peerinfo()
click to toggle source
Returns peer information (host + port) in host:port format.
# File lib/ssl_scan/socket/tcp.rb, line 56 def peerinfo if (pi = getpeername) return pi[1] + ':' + pi[2].to_s end end
shutdown(how = ::Socket::SHUT_RDWR)
click to toggle source
Calls shutdown on the TCP connection.
Calls superclass method
# File lib/ssl_scan/socket/tcp.rb, line 46 def shutdown(how = ::Socket::SHUT_RDWR) begin return (super(how) == 0) rescue ::Exception end end
type?()
click to toggle source
returns socket type
# File lib/ssl_scan/socket/tcp.rb, line 72 def type? return 'tcp' end