# File mrbgems/mruby-socket/mrblib/socket.rb, line 471 def initialize(path, &block) if self.is_a? UNIXServer super(path, "r") else super(Socket._socket(Socket::AF_UNIX, Socket::SOCK_STREAM, 0), "r+") Socket._connect(self.fileno, Socket.sockaddr_un(path)) if block_given? begin yield self ensure begin self.close unless self.closed? rescue StandardError end end end end end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 491 def self.socketpair(type=Socket::SOCK_STREAM, protocol=0) a = Socket.socketpair(Socket::AF_UNIX, type, protocol) [ UNIXSocket.for_fd(a[0]), UNIXSocket.for_fd(a[1]) ] end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 500 def addr [ "AF_UNIX", path ] end
# File mrbgems/mruby-socket/mrblib/socket.rb, line 504 def path Addrinfo.new(self.getsockname).unix_path end