WIP : WIP_CEV_READ and WIP_CEV_WRITE


#1

Hi everyone,

I use the Wip on the new openat 4.1 with a Q2686H.
I connect to a socket with

gprsWipChannel = wip_TCPClientCreateOpts((const ascii*) gprsFlashRegistry->SocketHost, gprsFlashRegistry->SocketPort, gprs_SocketHandler, NULL, 
											WIP_COPT_SND_BUFSIZE, 536,
											WIP_COPT_MAXSEG, 536,
											WIP_COPT_NODELAY, 1,
											WIP_COPT_SND_LOWAT, 1,
											WIP_COPT_RCV_LOWAT, 1,
											WIP_COPT_END);

and the events WIP_CEV_WRITE are not fired when there is 1 byte free in the buffer (for test purpose). WIP_CEV_READ are not fired when 1 byte is received…I don’t understand why…

thank you in advance

Best regards,

gdt


#2

Hello gdt,

WIP_CEV_READ and WIP_CEV_WRITE will fire if you open the socket and data arrives first time.
The other scenario, when you read or write more data than the socket can handle at that moment.

For example, in your incoming data processing routine when you receive the WIP_CEV_READ (first time you will) after you have red all available bytes just read additional byte(s) with wip_read() function. The WIP_CEV_READ event will come again when data arrives. In case of write, if the wip_write() function returns less value than the buffer length you provided, the WIP_CEV_WRITE will fire when you can send more data.

Best Regards,

tom


#3

Hi tom,

For the WIP_CEV_READ event, I don’t press enter in netcat, so the data where not send…I receive the event when it is correct.

For the WIP_CEV_WRITE event, I configured the wip_TCPClientCreateOpts with WIP_COPT_SND_LOWAT, 1 so according to the documentation, I must receive a WIP_CEV_WRITE event each 1 new byte free in the send buffer.

I receive this event only once at the connection to the socket…

If I want to know how much bytes are free in the buffer, I make polling on the WIP_COPT_NWRITE parameter with wip_getOpts.

Thanks in advance

Best regards,

gdt


#4

"In case of write, if the wip_write() function returns less value than the buffer length you provided, the WIP_CEV_WRITE will fire when you can send more data. " It’s normal that I not receive this event because I send never more data at one time that the wip can handle… I do that like i did it when I used edlib… hmmm some philosophic choices :wink:

Thank you for explanations

Best regards,

gdt