Hi,
I have a C6672 DSP and I'm trying to build a TCP server.
In the board initialization part, the code passes the platform_init() function and the QMSS, CPPI, and PA initializations (all of which return zero). I also call fdOpenSession() at the beginning of the task.
Then, when I call the "socket" function with IPv4, stream and TCP parameters, it returns -1. To find out why the socket creation has failed, I call fdError(), which also returns -1; however, there is no relevant error code "-1" for socket creation in header "serrno.h".
Here's a summary of how I try creating the socket:
void TcpTaskFxn(UArg arg1, UArg arg2)
{
int iStatus = fdOpenSession(TaskSelf());
if (iStatus != RET_OK)
{
/* Error Handling */
}
STcpCommand_t inboundMessage = {0};
SOCKET tcpSocket = CreateTcpServer();
while (true)
{
/* Task loop */
}
}
SOCKET CreateTcpServer(void)
{
SOCKET socketId = INVALID_SOCKET;
/* Open the socket. Use ARPA Internet address format and stream sockets. */
while (socketId == INVALID_SOCKET)
{
socketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); /* returns -1 */
if (socketId == INVALID_SOCKET)
{
int iError = fdError(); /* also returns -1 */
}
}
/* ... */
}
I'm also attaching the configuration file here (app.cfg.zip), in case it is needed.
Thanks in advance,
Silacko