Class: Rserve::Session

Inherits:
Object
  • Object
show all
Includes:
Protocol
Defined in:
lib/rserve/session.rb

Constant Summary collapse

UID =
-7048099825974875604

Constants included from Protocol

Protocol::CMD_RESP, Protocol::CMD_SPECIAL_MASK, Protocol::CMD_assignSEXP, Protocol::CMD_attachSession, Protocol::CMD_closeFile, Protocol::CMD_createFile, Protocol::CMD_ctrl, Protocol::CMD_ctrlEval, Protocol::CMD_ctrlShutdown, Protocol::CMD_ctrlSource, Protocol::CMD_detachSession, Protocol::CMD_detachedVoidEval, Protocol::CMD_eval, Protocol::CMD_login, Protocol::CMD_openFile, Protocol::CMD_readFile, Protocol::CMD_removeFile, Protocol::CMD_serAssign, Protocol::CMD_serEEval, Protocol::CMD_serEval, Protocol::CMD_setBufferSize, Protocol::CMD_setEncoding, Protocol::CMD_setSEXP, Protocol::CMD_shutdown, Protocol::CMD_voidEval, Protocol::CMD_writeFile, Protocol::DT_ARRAY, Protocol::DT_BYTESTREAM, Protocol::DT_CHAR, Protocol::DT_DOUBLE, Protocol::DT_INT, Protocol::DT_LARGE, Protocol::DT_SEXP, Protocol::DT_STRING, Protocol::ERROR_DESCRIPTIONS, Protocol::ERR_IOerror, Protocol::ERR_Rerror, Protocol::ERR_accessDenied, Protocol::ERR_auth_failed, Protocol::ERR_conn_broken, Protocol::ERR_ctrl_closed, Protocol::ERR_data_overflow, Protocol::ERR_detach_failed, Protocol::ERR_inv_cmd, Protocol::ERR_inv_par, Protocol::ERR_notOpen, Protocol::ERR_object_too_big, Protocol::ERR_out_of_mem, Protocol::ERR_session_busy, Protocol::ERR_unknownCmd, Protocol::ERR_unsupportedCmd, Protocol::MAX_LONG_SIGNED, Protocol::MAX_LONG_UNSIGNED, Protocol::RESP_ERR, Protocol::RESP_OK

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Protocol

#doubleToRawLongBits, #get_int, #get_int_original, #get_len, #get_long, #get_long_original, #longBitsToDouble, #longBitsToDouble_old, #new_hdr, #set_hdr, #set_int, #set_long

Constructor Details

#initialize(con, packet) ⇒ Session

Returns a new instance of Session.


13
14
15
16
17
18
19
20
21
22
# File 'lib/rserve/session.rb', line 13

def initialize(con,packet)
  @host=con.hostname
  @rsrv_version=con.rsrv_version
  ct=packet.cont
  if ct.nil? or ct.length!=32+3*4
    raise "Invalid response to session detach request."
  end
  @port=get_int(ct,4)
  @key=ct[12,32]
end

Instance Attribute Details

#attach_packetObject (readonly)

Returns the value of attribute attach_packet


11
12
13
# File 'lib/rserve/session.rb', line 11

def attach_packet
  @attach_packet
end

#hostObject (readonly)

Returns the value of attribute host


8
9
10
# File 'lib/rserve/session.rb', line 8

def host
  @host
end

#keyObject (readonly)

Returns the value of attribute key


10
11
12
# File 'lib/rserve/session.rb', line 10

def key
  @key
end

#portObject (readonly)

Returns the value of attribute port


9
10
11
# File 'lib/rserve/session.rb', line 9

def port
  @port
end

#rsrv_versionObject (readonly)

Returns the value of attribute rsrv_version


12
13
14
# File 'lib/rserve/session.rb', line 12

def rsrv_version
  @rsrv_version
end

Instance Method Details

#attachObject


23
24
25
26
27
# File 'lib/rserve/session.rb', line 23

def attach
  c=Rserve::Connection.new(:session=>self)
  @attach_packet=c.rt.request(:cmd=>-1,:cont=>[])
  c
end