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. - #inspect Internal use only
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 1038
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 1048
attr_reader :local_address
#remote_address (readonly)
Address of the source
# File 'ext/socket/lib/socket.rb', line 1045
attr_reader :remote_address
Instance Method Details
#inspect
This method is for internal use only.
[ GitHub ]
# File 'ext/socket/lib/socket.rb', line 1050
def inspect # :nodoc: "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>".dup end
#reply(msg)
Sends the String msg
to the source
# File 'ext/socket/lib/socket.rb', line 1055
def reply(msg) @reply_proc.call msg end