wip_setOpts() threshold trigger doesn't work

Hi Guys

Tweaking ftp_put sample, of Open AT ® WIP Plug-in 3.00 Build 09, where a text file is to be sent to a FTP server:

void appli_entry_point() {

  wip_debug( "Opening FTP connection...\n");

  dst_ftp_cx = wip_FTPCreateOpts (
    DST_SERVER,  evh_cx, NULL,
    WIP_COPT_USER,     DST_USER,
    WIP_COPT_PASSWORD, DST_PASSWORD,
    WIP_COPT_PASSIVE,  DST_ISPASSIVE,
    WIP_COPT_END);

  if( ! dst_ftp_cx) { wip_debug( "Can't open dst FTP connection\n"); return; }
}

I use wip_setOpts to trigger write events only when there is 3kb in the send buffer like below in WIP_CEV_OPEN: :smiley:

static void evh_data( wip_event_t *ev, void *ctx) {
  
  switch( ev->kind) {

  case WIP_CEV_OPEN:
	  wip_setOpts( ev->channel, WIP_COPT_SND_LOWAT, 3000, WIP_COPT_END);  //Here is where I put wip_setOpts
      break;


  case WIP_CEV_WRITE: {
    int nwrite = wip_write( dst_data, buffer, sizeof( buffer) - offset);
    if( nwrite < 0) {  return; }
    offset += nwrite;
    if( offset == sizeof( buffer)) { 
      wip_close( dst_data);   dst_data   = NULL;
      wip_close( dst_ftp_cx); dst_ftp_cx = NULL;
    }
    break;
  }

  case WIP_CEV_ERROR:
       break;
  }
}

My send buffer is 3 bytes only:

static u8 buffer [] =  
  "ta \n";

How come I received the text file in my FTP server right after I start the program? 3b is not enough to trigger the write event. Did I misplaced my wip_setOpts ? :mrgreen: Did I missed something?

Advance thanks.