WIZnet Developer Forum


Trying to implement httpclient:

while (http_client_on)
    http_client=httpclient(SOCK_HTTPC, gDATABUF, PORT_HTTPC);

Everything works fine.
But if execution of my_code() takes more than 60 sec. httpclient hangs on connect(sn, Domain_IP, PORT_HTTPS);
Error SOCKERR_TIMEOUT is generated and program exits loop.
How this problem can be solved?

Thank you.

Hello, tuxxas

You mean timeout generated when client is waiting for peer ack after my_code() takes 60s… is it right?

so… you want not to make timeout during 60s.

If your case is that I say, timeout occur is in normal operation.

We offer RTR and RCR Register to control socket timeout.

So, if you make RTR longer then default, I guess client still wait peer ack after 60s.

And… if it is not working, could you upload more details?

code and packet…

Thank you


managed to eliminate previous error SOCKERR_TIMEOUT .
Client is communicating with server rather reliably via GET/POST.
But similar problem remains: if there is a significant interval in time (the duration can’t be predicted) between lan activity, pause occurs in socket.c loop “while”:
connect(sn). While looping getSn_SR(sn) is equal to SOCK_SYNSENT (0x15).

... while(getSn_SR(sn) != SOCK_ESTABLISHED) { if (getSn_IR(sn) & Sn_IR_TIMEOUT) { setSn_IR(sn, Sn_IR_TIMEOUT); #if _WIZCHIP_ == 5200 // for W5200 ARP errata setSUBR((uint8_t*)"\x00\x00\x00\x00"); #endif return SOCKERR_TIMEOUT; } }...
or disconnect(sn). While looping getSn_SR(sn) is equal to SOCK_LAST_ACK (0x1D).

... while(getSn_SR(sn) != SOCK_CLOSED) { if(getSn_IR(sn) & Sn_IR_TIMEOUT) { close(sn); return SOCKERR_TIMEOUT; } }...
Is it possible to get out without delay and what is the reason of this problem?

Thank you

Do you want to no spend any time in that while()?

But actually both needed in TCP communication.

If there is no checking sock_established and sock_closed, the communication will be un-connected or un-closed.

Both while() make some problem in your process??

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.