Class: Socket::UDPSource
Relationships & Source Files | |
Inherits: | Object |
Defined in: | ext/socket/lib/socket.rb |
Overview
UDP/IP address information used by udp_server_loop.
Class Method Summary
-
.new(remote_address, local_address, &reply_proc) ⇒ UDPSource
constructor
#remote_address is an ::Addrinfo object.
Instance Attribute Summary
-
#local_address
readonly
Local address.
-
#remote_address
readonly
Address of the source.
Instance Method Summary
-
#reply(msg)
Sends the String
msg
to the source.
Constructor Details
.new(remote_address, local_address, &reply_proc) ⇒ UDPSource
#remote_address is an ::Addrinfo object.
#local_address is an ::Addrinfo object.
reply_proc
is a Proc used to send reply back to the source.
# File 'ext/socket/lib/socket.rb', line 740
def initialize(remote_address, local_address, &reply_proc) @remote_address = remote_address @local_address = local_address @reply_proc = reply_proc end
Instance Attribute Details
#local_address (readonly)
Local address
# File 'ext/socket/lib/socket.rb', line 750
attr_reader :local_address
#remote_address (readonly)
Address of the source
# File 'ext/socket/lib/socket.rb', line 747
attr_reader :remote_address
Instance Method Details
#reply(msg)
Sends the String msg
to the source
# File 'ext/socket/lib/socket.rb', line 757
def reply(msg) @reply_proc.call msg end