shutdown

basicsocket.shutdown([how]) => 0
Instance Public methods

Calls shutdown(2) system call.

s.shutdown(Socket::SHUT_RD) disallows further read.

s.shutdown(Socket::SHUT_WR) disallows further write.

s.shutdown(Socket::SHUT_RDWR) disallows further read and write.

how can be symbol or string:

  • :RD, :SHUT_RD, âRDâ and âSHUT_RDâ are accepted as Socket::SHUT_RD.

  • :WR, :SHUT_WR, âWRâ and âSHUT_WRâ are accepted as Socket::SHUT_WR.

  • :RDWR, :SHUT_RDWR, âRDWRâ and âSHUT_RDWRâ are accepted as Socket::SHUT_RDWR.

    UNIXSocket.pair {|s1, s2|

    s1.puts "ping"
    s1.shutdown(:WR)
    p s2.read          #=> "ping\n"
    s2.puts "pong"
    s2.close
    p s1.read          #=> "pong\n"
    

    }

doc_ruby_on_rails
2015-03-31 01:49:14
Comments
Leave a Comment

Please login to continue.