Class: ClientTCPSocketPackagedPipe
- Inherits:
-
Object
- Object
- ClientTCPSocketPackagedPipe
- Defined in:
- lib/appswarm/tools/pipes.rb
Constant Summary collapse
- MAX_PKG_SIZE =
100000
Instance Method Summary collapse
-
#initialize(host, port) ⇒ ClientTCPSocketPackagedPipe
constructor
A new instance of ClientTCPSocketPackagedPipe.
- #recvPackage ⇒ Object
- #writePackage(str) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ ClientTCPSocketPackagedPipe
Returns a new instance of ClientTCPSocketPackagedPipe.
5 6 7 8 9 10 |
# File 'lib/appswarm/tools/pipes.rb', line 5 def initialize(host,port) @socket=TCPSocket.new(host,port) @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) @inPackages=[] recvLoop end |
Instance Method Details
#recvPackage ⇒ Object
16 17 18 |
# File 'lib/appswarm/tools/pipes.rb', line 16 def recvPackage @inPackages.shift end |
#writePackage(str) ⇒ Object
12 13 14 15 |
# File 'lib/appswarm/tools/pipes.rb', line 12 def writePackage(str) @socket.write(str) @socket.flush end |