peeraddr

unixsocket.peeraddr => [address_family, unix_path] Instance Public methods Returns the remote address as an array which contains address_family and unix_path. Example serv = UNIXServer.new("/tmp/sock") c = UNIXSocket.new("/tmp/sock") p c.peeraddr #=> ["AF_UNIX", "/tmp/sock"]

recv_io

unixsocket.recv_io([klass [, mode]]) => io Instance Public methods IO.open(â/tmp/sockâ) {|serv| UNIXSocket.open("/tmp/sock") {|c| s = serv.accept c.send_io STDOUT stdout = s.recv_io p STDOUT.fileno #=> 1 p stdout.fileno #=> 7 stdout.puts "hello" # outputs "hello\n" to standard output. } }

recvfrom

unixsocket.recvfrom(maxlen [, flags]) => [mesg, unixaddress] Instance Public methods Receives a message via unixsocket. maxlen is the maximum number of bytes to receive. flags should be a bitwise OR of Socket::MSG_* constants. s1 = Socket.new(:UNIX, :DGRAM, 0) s1_ai = Addrinfo.unix("/tmp/sock1") s1.bind(s1_ai) s2 = Socket.new(:UNIX, :DGRAM, 0) s2_ai = Addrinfo.unix("/tmp/sock2") s2.bind(s2_ai) s3 = UNIXSocket.for_fd(s2.fileno) s1.send "a", 0, s2_ai p s3.recvfrom(10) #=> ["

send_io

unixsocket.send_io(io) => nil Instance Public methods Sends io as file descriptor passing. s1, s2 = UNIXSocket.pair s1.send_io STDOUT stdout = s2.recv_io p STDOUT.fileno #=> 1 p stdout.fileno #=> 6 stdout.puts "hello" # outputs "hello\n" to standard output.

decode

decode(*arg) Instance Public methods Alias for: unescape

encode

encode(*arg) Instance Public methods Alias for: escape

escape

escape(*arg) Instance Public methods Synopsis URI.escape(str [, unsafe]) Args str String to replaces in. unsafe Regexp that matches all symbols that must be replaced with codes. By default uses REGEXP::UNSAFE. When this argument is a String, it represents a character set. Description Escapes the string, replacing all unsafe characters with codes. Usage require 'uri' enc_uri = URI.escape("http://example.com/?a=\11\15") p enc_uri # => "http://example.com/?a=%09%0D" p U

unescape

unescape(*arg) Instance Public methods Synopsis URI.unescape(str) Args str Unescapes the string. Usage require 'uri' enc_uri = URI.escape("http://example.com/?a=\11\15") p enc_uri # => "http://example.com/?a=%09%0D" p URI.unescape(enc_uri) # => "http://example.com/?a=\t\r" decode

build

build(args) Class Public methods Description Creates a new URI::FTP object from components, with syntax checking. The components accepted are userinfo, host, port, path and typecode. The components should be provided either as an Array, or as a Hash with keys formed by preceding the component names with a colon. If an Array is used, the components must be passed in the order userinfo, host, port, path, typecode If the path supplied is absolute, it will be escaped in order to make

new

new(*arg) Class Public methods Description Creates a new URI::FTP object from generic URL components with no syntax checking. Unlike build(), this method does not escape the path component as required by RFC1738; instead it is treated as per RFC2396. Arguments are scheme, userinfo, host, port, registry, path, opaque, query and fragment, in that order.