123456789_123456789_123456789_123456789_123456789_

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

Instance Attribute Summary

Instance Method Summary

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.

[ GitHub ]

  
# File 'ext/socket/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 (readonly)

Local address

[ GitHub ]

  
# File 'ext/socket/lib/socket.rb', line 1042

attr_reader :local_address

#remote_address (readonly)

Address of the source

[ GitHub ]

  
# File 'ext/socket/lib/socket.rb', line 1039

attr_reader :remote_address

Instance Method Details

#reply(msg)

Sends the String msg to the source

[ GitHub ]

  
# File 'ext/socket/lib/socket.rb', line 1049

def reply(msg)
  @reply_proc.call msg
end