![background image](http://html1.mh-extra.com/html/aim/api-fdx-2-v2/api-fdx-2-v2_getting-started-manual_2871728030.webp)
22
API-FDX Linux Getting Started Manual
GmbH
Section 8 – Programming the API-FDX Module
// search the server-list for local server
px_TmpServer = px_ServerNames;
while ((px_TmpServer != NULL) && (!bFoundLocalServer))
{
if (stricmp(px_TmpServer->auc_ServerName, "local") == 0)
{
bFoundLocalServer = true;
}
else
{
px_TmpServer = px_TmpServer->px_Next;
}
}
//Query the local server configuration and login to the board and ports
if (bFoundLocalServer)
{
if (FdxQueryServerConfig("local", &pRLEHead) == FDX_OK)
{
pRLE = pRLEHead;
while (pRLE != NULL)
{ //--- login to resources
switch(pRLE->ul_ResourceType)
{
case RESOURCETYPE_BOARD:
if (g_ulBoardHandle == 0)
{
if(FdxLogin("local",x_ClientInfo,
pRLE->ul_ResourceID,0,&g_ulBoardHandle)!= FDX_OK)
g_ulBoardHandle = 0;
}
break;
case RESOURCETYPE_PORT:
if (g_ulPort1Handle == 0)
{
if(FdxLogin("local",x_ClientInfo,
pRLE->ul_ResourceID,0,&g_ulPort1Handle) != FDX_OK)
g_ulPort1Handle = 0;
}
else
if (g_ulPort2Handle == 0)
{
if(FdxLogin("local",x_ClientInfo,
pRLE->ul_ResourceID,0,&g_ulPort2Handle) != FDX_OK)
g_ulPort2Handle = 0;
}
break;
}
pRLE = pRLE->px_Next;
}
}
}