Exemple #1
0
BOOL WINAPI DllMain(HANDLE procHandle, DWORD reason, LPVOID reserved)
{
	if(reason == DLL_PROCESS_ATTACH)
	{
		g_dllHandle = procHandle;

		OnAttach();
	}

	return TRUE;
}
//=================================================================================================
void axSceneEntity::Attach(axSceneGraphNode* a_pNode)
{
	axAssert(m_pParent == NULL, axL("Scene entity is already attached."));

	m_pParent = a_pNode;
	m_pParent->AttachEntity(this);

	if(m_eCullingMethod == eAlwaysVisible)
		m_pParent->GetSceneGraph()->AddNonCulledEntity(this, m_u8VisibilityMask);

	OnAttach();
}
int CIpSocket::Create( int x_af, int x_type, int x_protocol, int x_timeout )
{
	// Punt if not initialized
	if ( !IsInitialized() )
		return 0;

	// Close any open socket
	Destroy();

	// Clear errors
	m_uLastError = 0;

	// Create a scocket
	m_hSocket = (t_SOCKET)socket( (int)x_af, (int)x_type, (int)x_protocol );

	// Save the last error code
	m_uLastError = WSAGetLastError();
	if ( WSAEWOULDBLOCK == m_uLastError )
		m_uLastError = 0;

	// Was there an error?
	if ( c_InvalidSocket == m_hSocket )
	{	m_uConnectState |= eCsError;
		return 0;
	} // end if

	// Set default timeout
	if ( 0 >= x_timeout )
		x_timeout = m_lTimeout;

	// Setup socket timeout defaults
	struct timeval tv;
	tv.tv_sec = ( x_timeout / 1000 );
	tv.tv_usec = ( x_timeout % 1000 ) * 1000;
	setsockopt( (SOCKET)m_hSocket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof( tv ) );
	setsockopt( (SOCKET)m_hSocket, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof( tv ) );

	// Process socket creation
	if ( !OnAttach() )
	{	Destroy();
		return 0;
	} // end if

	// Save socket connect params
	m_uSocketFamily = x_af;
	m_uSocketType = x_type;
	m_uSocketProtocol = x_protocol;

	// Capture all events
	EventSelect();

	return IsSocket();
}
int CIpSocket::Create( int x_af, int x_type, int x_protocol, int x_timeout )
{
	// Punt if not initialized
	if ( !IsInitialized() )
		return 0;

	// Close any open socket
	Destroy();

	// Create a scocket
	m_hSocket = (t_SOCKET)tcULongToPtr( socket( (int)x_af, (int)x_type, (int)x_protocol ) );

	if ( c_InvalidSocket == m_hSocket )
    {	m_uLastError = errno;
		return 0;
	} // end if

	// Default timeout?
	if ( 0 >= x_timeout )
		x_timeout = m_lTimeout;
	
	// Setup socket timeout defaults
	struct timeval tv;
	tv.tv_sec = ( x_timeout / 1000 );
	tv.tv_usec = ( x_timeout % 1000 ) * 1000;
	setsockopt( tcPtrToULong( m_hSocket ), SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof( tv ) );
	setsockopt( tcPtrToULong( m_hSocket ), SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof( tv ) );

	// Process socket creation
	if ( !OnAttach() )
	{	Destroy();
		return 0;
	} // end if

	m_uLastError = 0;

    // Save socket connect params
    m_uSocketFamily = x_af;
    m_uSocketType = x_type;
    m_uSocketProtocol = x_protocol;

	int set = 1;
	if ( -1 == setsockopt( tcPtrToULong( m_hSocket ), SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set) ) )
//		WARNING( errno, tcT( "socket interface does not support SO_REUSEADDR" ) );
		;

	// Capture all events
	EventSelect();

	return IsSocket();
}
int CIpSocket::Attach( t_SOCKET x_hSocket, int x_bFree )
{
	// Lose the old socket
    Destroy();

	// Save socket handle
    m_hSocket = x_hSocket;

	// Should we free the socket?
	m_bFree = x_bFree;

	// Call on attach
	if ( !OnAttach() )
		Destroy();

	// How'd it go?
    return IsSocket();
}
Exemple #6
0
void cbPlugin::Attach()
{
    if (m_IsAttached)
        return;
    wxWindow* window = Manager::Get()->GetAppWindow();
    if (window)
    {
        // push ourself in the application's event handling chain...
        window->PushEventHandler(this);
    }
    m_IsAttached = true;
    OnAttach();
    SetEvtHandlerEnabled(true);

    CodeBlocksEvent event(cbEVT_PLUGIN_ATTACHED);
    event.SetPlugin(this);
    // post event in the host's event queue
    Manager::Get()->ProcessEvent(event);
}
 virtual bool Attach
 (XosWebRtcClientWindowPeerImplement* window=0)
 {
     m_window = window;
     return OnAttach();
 }
	bool GameObjectComponent::Attach(GameObjectPtr pObject)
	{
		m_pObject = pObject;

		return OnAttach();
	}
Exemple #9
0
void CAsynSocket::_OnAttach()
{
	OnAttach();
}
Exemple #10
0
void APowerUp::Attach_Implementation(APlayerCube* PlayerCube)
{
	OnAttach(PlayerCube);
}