ISocket_Bind Error | developer.brewmp.com ISocket_Bind Error | developer.brewmp.com

Developer

ISocket_Bind Error

Forums:

case EVT_APP_START:
ListenForConnection(pMe);

void ListenForConnection(brewclient * pMe)
{
int result;

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_NET, (void **)&pMe->pINetMgr);
pMe->pISocket = INETMGR_OpenSocket(pMe->pINetMgr, AEE_SOCK_STREAM);

if (!pMe->pISocket)
return;

tryBind(pMe);

result = ISOCKET_Listen(pMe->pISocket, 3);

if(result == AEE_NET_SUCCESS)
{
ISOCKET_Accept(pMe->pISocket, pMe->SocketPtr);
if(pMe->SocketPtr)
{
//ReadRequest(pMe);
//return;
}
}
else if(result == AEE_NET_WOULDBLOCK)
{

// ISOCKET_Accept(pMe->pISocket, pMe->SocketPtr);
// ISOCKET_Readable(pMe->pISocket, ListenForConnection, pMe);
}
else
{
result = ISOCKET_GetLastError(pMe->pISocket);
}

}

static void tryBind(brewclient * pMe)
{
int nErr;

AEESockAddrStorage sa;

#define SERVER_PORT 0x200
#define SERVER_ADDR AEE_INADDR_ANY
sa.wFamily = AEE_AF_INET;
sa.inet.port = HTONS( SERVER_PORT );

nErr = ISOCKET_Bind(pMe->pISocket, SERVER_ADDR, sa.inet.port);

if(nErr != AEE_NET_SUCCESS )
{
nErr = ISOCKET_GetLastError(pMe->pISocket);
if(nErr == AEE_NET_EWOULDBLOCK)
{
ISOCKET_Writeable(pMe->pISocket, (PFNNOTIFY)tryBind,pMe);
return;

}
}

}

ISocket_Bind returns nErr as -2 and ISOCKET_GetLastError returns nErr as 516 and ISocket_Listen returns result as -1. May I know what is the problem with my code?

Thanks.

-2 is AEE_NET_WOULDBLOCK.
try to listen based on bind success..

-2 is AEE_NET_WOULDBLOCK.
try to listen based on bind success..

Hi manju,
May I know how to listen based on bind success?

Hi manju,
May I know how to listen based on bind success?