Class: ClientTCPSocketPackagedPipe

Inherits:
Object
  • Object
show all
Defined in:
lib/appswarm/tools/pipes.rb

Constant Summary collapse

MAX_PKG_SIZE =
100000

Instance Method Summary collapse

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

#recvPackageObject



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