Part Number:OMAP-L138
Tool/software: TI-RTOS
Hi,
I have a problem with the NDK_recv function. When I receive less then 1456B of data the program works correctly but when I want to receive more then 1456B then NDK_recv returns -1 and I see am error NDK_EWOULDBLOCK..
static void NetworkOpen() { hFtp = DaemonNew( SOCK_STREAM, 0, 21, dtask_ftp, OS_TASKPRINORM, 65536, 0, 3); } int dtask_ftp(SOCKET s, uint32_t unused){ struct timeval timeout; int ret; char buffer[BSIZE]; int bytes_read; Command cmd;// = malloc(sizeof(Command)); State state; /* Configure our socket timeout to be 5 seconds */ timeout.tv_sec = 10; timeout.tv_usec = 0; setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout) ); timeout.tv_sec = 40; //Ustawienie na 40 sek, gdyz niektore menadzery do FTP wysylaja co okolo 30s zapytanie o nowe dane, //jak bedzie rzadziej niz 40s, wowczas polaczenie bedzie po prostu ponawiane timeout.tv_usec = 0; setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout) ); //setsockopt(s, SOL_SOCKET, SO_DEBUG, NULL, 0 );
/** Handle STOR command. TODO: check permissions. */
void ftp_stor(Command *cmd, State *state){
SOCKET connection = NULL;
FRESULT fr;
FIL file;
char buf[BUF_SIZE];
unsigned int numWrite;
int numRecv;
int recv_total = 0;
int fileOpenFlag = 0;
if(state->logged_in){
/* Passive mode */
if(state->mode == SERVER){
fr = f_open(&file, cmd->arg, FA_CREATE_ALWAYS | FA_WRITE); //otwarcie pliku w trybie do zapisu,
//jezeli isnieje to zostanie nadpisany,
//jezeli nie, to zostanie utworzony
if(fr == FR_OK){
fileOpenFlag = 1;
connection = accept_connection(state->sock_pasv);
if(fdClose(state->sock_pasv)){
PRINTF_DEBUG("%s %s():%d, fdClose(), nieudana proba zamkniecia socketu\r\n", __FILE__, __FUNCTION__, __LINE__);
}
state->message = "125 Data connection already open; transfer starting.\n";
write_state(state);
recv_total = 0;
int i = 0;
while(1){
//PRINTF_DEBUG("czekanie na dane, i = %d\r\n", i);
numRecv = recv(connection, buf, BUF_SIZE, MSG_WAITALL ); //HERE I HAVE A PROBLEM
.........................
I'm using the latest SDK
Where should I look for a problem?
Regards, Patryk