Class: RBus::Transport::UNIXTransport

Inherits:
AbstractTransport show all
Defined in:
lib/rbus/bus/transport.rb

Overview

Represents a connection to a UNIX Socket, abstract or regular.

Constant Summary

Constants inherited from AbstractTransport

AbstractTransport::CRLF

Instance Attribute Summary

Attributes inherited from AbstractTransport

#socket

Instance Method Summary collapse

Methods inherited from AbstractTransport

#close, #initialize, #read, #readline, #send, #sendline

Constructor Details

This class inherits a constructor from RBus::Transport::AbstractTransport

Instance Method Details

#create_socketObject



70
71
72
73
74
75
76
77
# File 'lib/rbus/bus/transport.rb', line 70

def create_socket
  if @connection_info.has_key?('abstract')
    @socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_STREAM, 0)
    @socket.connect("\1\0\0#{@connection_info['abstract']}")
  elsif @connection_info.has_key?('path')
    @socket = UNIXSocket.open(@connection_info['path'])
  end
end