Class: UDPProxy::Client
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- UDPProxy::Client
- Defined in:
- lib/udp_proxy/client.rb
Instance Attribute Summary collapse
-
#client_ip ⇒ Object
Returns the value of attribute client_ip.
-
#client_port ⇒ Object
Returns the value of attribute client_port.
Instance Method Summary collapse
-
#initialize(client_ip, client_port, server) ⇒ Client
constructor
A new instance of Client.
- #receive_data(data) ⇒ Object
Constructor Details
#initialize(client_ip, client_port, server) ⇒ Client
Returns a new instance of Client.
6 7 8 9 |
# File 'lib/udp_proxy/client.rb', line 6 def initialize(client_ip, client_port, server) @client_ip, @client_port = client_ip, client_port @server = server end |
Instance Attribute Details
#client_ip ⇒ Object
Returns the value of attribute client_ip.
4 5 6 |
# File 'lib/udp_proxy/client.rb', line 4 def client_ip @client_ip end |
#client_port ⇒ Object
Returns the value of attribute client_port.
4 5 6 |
# File 'lib/udp_proxy/client.rb', line 4 def client_port @client_port end |
Instance Method Details
#receive_data(data) ⇒ Object
11 12 13 14 |
# File 'lib/udp_proxy/client.rb', line 11 def receive_data(data) port, ip = Socket.unpack_sockaddr_in(get_peername) @server.send_datagram(data, client_ip, client_port) end |