Name

BasicSocket — Socket-related superclass

Synopsis

BasicSocket is an abstract base class for network socket-related classes. This class provides common behavior among Socket classes.

Required Library

require ’socket’

Inherited Class

IO

Class Methods

BasicSocket::do_not_reverse_lookup

Returns true if a query returns numeric address, not hostname

BasicSocket::do_not_reverse_lookup=bool

Sets reverse_lookup status

Instance Methods

s.getpeername

Returns information on this connection’s peer socket as a struct sockaddr packed into a string.

s.getsockname

Returns information on s as a struct sockaddr packed into a string.

s.getsockopt(lev, optname)

Gets the specified socket option.

s.setsockopt(lev, optname, value)

Sets the specified socket option.

s.shutdown([how=2])

Shuts down the socket connection. 0 shuts down receiving, 1 sending, and 2 both.

s.recv(len[, flags])

Receives data from s, and returns it as a string.

s.send(mesg, flags[, to])

Sends data over the socket s, returning the length of the data sent. to may be a struct sockaddr packed into a string indicating the recipient address.

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.