Logo Search packages:      
Sourcecode: ardour version File versions

bool ImageFrameSocketHandler::connect ( const char *  hostIp,
int32_t  port 
)

Attempt to connect to the image compositor on the specified host and port

Parameters:
hostIp the ip address of the image compositor host
port the oprt number to attemp the connection on
Returns:
true if the connection was a succees false otherwise

Definition at line 188 of file imageframe_socket_handler.cc.

References is_connected(), and theArdourToCompositorSocket.

{
      if (is_connected())
      {
            //already connected...
            return(true) ;
      }
      
      theArdourToCompositorSocket = socket(AF_INET, SOCK_STREAM, 0) ;
      if(theArdourToCompositorSocket == -1)
      {
            return(false) ;
      }
      
      int on = 1 ;
      setsockopt(theArdourToCompositorSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) ;
      
      sockaddr_in m_addr ;
      m_addr.sin_family = AF_INET ;
      m_addr.sin_port = htons(port) ;
      m_addr.sin_addr.s_addr = inet_addr(hostIp) ;
      
      int status = ::connect(theArdourToCompositorSocket, (sockaddr *) &m_addr, sizeof(m_addr)) ;
      
      if(status == -1)
      {
            theArdourToCompositorSocket = -1 ;  
            return(false) ;
      }
      
      return(true) ;
}


Generated by  Doxygen 1.6.0   Back to index