Class: Socket::UDPSource
- Inherits:
-
Object
- Object
- Socket::UDPSource
- Defined in:
- lib/socket.rb
Overview
UDP/IP address information used by Socket.udp_server_loop.
Instance Attribute Summary collapse
-
#local_address ⇒ Object
readonly
Local address.
-
#remote_address ⇒ Object
readonly
Address of the source.
Instance Method Summary collapse
-
#initialize(remote_address, local_address, &reply_proc) ⇒ UDPSource
constructor
remote_address
is an Addrinfo object. -
#inspect ⇒ Object
:nodoc:.
-
#reply(msg) ⇒ Object
Sends the String
msg
to the source.
Constructor Details
#initialize(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.
1032 1033 1034 1035 1036 |
# File 'lib/socket.rb', line 1032 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 ⇒ Object (readonly)
Local address
1042 1043 1044 |
# File 'lib/socket.rb', line 1042 def local_address @local_address end |
#remote_address ⇒ Object (readonly)
Address of the source
1039 1040 1041 |
# File 'lib/socket.rb', line 1039 def remote_address @remote_address end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
1044 1045 1046 |
# File 'lib/socket.rb', line 1044 def inspect # :nodoc: "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>".dup end |
#reply(msg) ⇒ Object
Sends the String msg
to the source
1049 1050 1051 |
# File 'lib/socket.rb', line 1049 def reply(msg) @reply_proc.call msg end |