Namespace

Included Modules

Class/Module Index [+]

Quicksearch

Rex::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.

# File lib/rex/socket/tcp.rb, line 23
def self.create(hash = {})
        hash['Proto'] = 'tcp'
        self.create_param(Rex::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/rex/socket/tcp.rb, line 32
def self.create_param(param)
        param.proto = 'tcp'
        Rex::Socket.create_param(param)
end

Public Instance Methods

localinfo() click to toggle source

Returns local information (host + port) in host:port format.

# File lib/rex/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/rex/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.

# File lib/rex/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/rex/socket/tcp.rb, line 72
def type?
        return 'tcp'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.