Sha256: 89f47105eb0cbce601a630d325619decbe46555ed2891300381219af8f6b88fa
Contents?: true
Size: 792 Bytes
Versions: 6
Compression:
Stored size: 792 Bytes
Contents
require 'asir/transport/connection_oriented' require 'socket' module ASIR class Transport # !SLIDE # TCP Socket Transport class TcpSocket < ConnectionOriented # !SLIDE # TCP Socket Client def _client_connect! sock = TCPSocket.open(host, port) end # !SLIDE # TCP Socket Server def _server! @server = TCPServer.open(port) @server.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, false) end def _server_accept_connection! server socket = server.accept [ socket, socket ] # Use same socket for in_stream and out_stream end def _server_close_connection! stream, out_stream stream.close rescue nil end end # !SLIDE END end # class end # module
Version data entries
6 entries across 6 versions & 1 rubygems