I tried to use raw socket on am3359 and ti-rtos. The example is adapted form enetlwip provided in the am3359 ind sdk packages. the code as follows:
Task_sleep(5000);
fdOpenSession(TaskSelf());
s = socket(AF_RAWETH, SOCK_RAWETH, rawether_type);
if(s == INVALID_SOCKET)
{
UARTPutString(uartInstance,"\r\ncreate socket error\r\n");
//printf("\ncreate socket error");
//printf("\nsocket>> %d", fdError());
fdCloseSession (TaskSelf());
}
val = 0;
//interface card no , such as 0, 1
retVal = setsockopt(s, SOL_SOCKET, SO_IFDEVICE, &val, sizeof(val));
if(retVal)
{
//printf("\nsetsockopt_IFDEVICE>> %d", fdError());
UARTPutString(uartInstance,"\r\nerror in setsockopt for SO_IFDEVICE\r\n");
retVal = fdError();
ltoa(retVal, res);
UARTPutString(uartInstance,res);
UARTPutString(uartInstance,"\r\n");
//printf("\nerror in setsockopt ");
}
...
first , create socket is ok . but setsockopt for SO_IFDEVICE is wrong and retVal is 22, which means invalid argument. however, the following setsockopt statementis ok ,such as timeout setup and buffer setup.
I commented the http functions which remains in the example, and the error remains.