Class: NetworkFacade::TCP::Server
- Inherits:
-
Base::Server
- Object
- Base::Server
- NetworkFacade::TCP::Server
- Defined in:
- lib/network-facade/tcp.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base::Server
Instance Method Summary collapse
- #accept ⇒ Object
- #client_id(client) ⇒ Object
-
#initialize(options = {}) ⇒ Server
constructor
A new instance of Server.
Methods inherited from Base::Server
Constructor Details
Instance Method Details
#accept ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/network-facade/tcp.rb', line 35 def accept client = @options[:server].accept NetworkFacade.log(:info, "Accept", client.peeraddr[2]) client.setsockopt(Socket::SOL_TCP, Socket::TCP_NODELAY, 1) if @options[:no_delay] client.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if @options[:close_exec] client end |
#client_id(client) ⇒ Object
43 44 45 |
# File 'lib/network-facade/tcp.rb', line 43 def client_id(client) client.peeraddr[2] end |