WIZnet Developer Forum

Can't reconnect to tcp server without restart

I’m using a WizFi-630 in AP mode as a Serial to TCP device. The WizFi is acting as the TCP server as I want multiple devices to attach to it ( no more than the limit of 5).

I can connect fine to the TCP server and serial data flows both ways - but if the connection gets broken unexpectedly e.g. TCP client goes out of WiFi range then I cannot re connect to the TCP server again from the same client unless the WizFi is rebooted.

I guess that because the TCP server never see’s a socket closure request it stays open, but it doesn’t seem to have an in-activity timeout associated to it so it will never close. Also it must keep track of the ip’s of whos connected because it won’t allow that device to re-connect.

Is this the expected behavour?
Is there a way for me to re-connect to the WizFi TCP server if the connection breaks unexpectedly? ( Unfortunately I can’t just pretend the socket is open all the time and continue to send data as the client is a tablet and the socket gets destroyed -so I have to create a new conneection )

Thanks Rory

Hi

I think that It appears because TCP socket is not closed normally like your ideas.
But I don’t understand your one situation as “I cannot re connect to the TCP server again from the same client unless the WizFi is rebooted”. It seems that your client program is not close socket regardless of TCP server of WizFi630.
Please check this point.

And If you want to close TCP server socket of WizFi630 when connection gets broken unexpectedly, You can use in-activity timeout.
in-activity timeout means that TCP/IP connection is discontinued if there is neither serial data nor network data during the set time. So there is neither serial data, WizFi630 will close socket connection.

Thank you.

Thanks for the reply,

But as I stated in my original post, the inactivity timer doesn’t work - but I noted you saying that the timer requires both no Serial data and no TCP connection and in my situation the flow of serial data is constant.

I realize that my client program isn’t closing the socket - because it is out of range it is impossible for it too close the connection, and because the device is a tablet running a third party OS ( Android ) I have no control on retaining the last state of the socket because as soon as the WiFi goes the socket is thrown out in memory and I am forced to create a new connection. I can’t just pretend the connection is still open and close it gracefully.

Why does the WizFi630 not allow me to re-establish connection with the TCP server ? ( without rebooting )
Why does the activity timeout require both no serial and no network traffic ? - that makes it useless to me and alot of people I imagine.

Hi

I guessed that WizFi630 already five time connected without socket close from client device.
So WizFi630 can’t connect other client socket in order to it already keeps max count socket connection.

I have two solution.
First, Using in-activity timeout.
If you set in-activity timeout,WizFi630 can clean the socket connection when did not input serial data during the set time.

If you can’t use this solution, I recommend to test using new firmware. But this firmware is not official release yet.
If you want this firmware, I will send to you via your e-mail.

Thanks

Actually as I mentioned in my first post this happens after only one socket connection is generated. That is why I asked whether the WizFi is setup to not allow a connection from a device if it already thinks it has one open with that device on the same port.

Anyway, new firmware sounds like it could be worth a shot. Hopefully you can read my email address.

Cheers,

Rory

Hi

I send new firmware file to you via your e-mail.
Please check your e-mail and I hope that your problem solved using this firmware.

Thanks, I received your email and will give that firmware a go - I’ll let you know how it goes.

I have the same problem.
How did the new firmware work?
Can you please send me the firmware!

I have received the 1.1.29 FW and tried that. The problem is still there.

Inactivity Time settings: 5 seconds
Scenario to reproduce.

  1. Connect to the WizFi630 wifi network.
  2. Connect to open serial socket.
  3. Verify that you get data.
  4. Connect to another wifi. (NOTE: Keep socket open!) Simply press the wifi manager in windows and connect to another wifi.
    Socket will close.
    Repeat from 1.

After a few retires you will stop getting data on the socket. You need to restart the WizFi630 to get it back again.

The Scenario will happen when you are connected to the wifi and you move out of range and then come back into range. For example if you run a quadro-copter or similar.

What I would like to see is that the WizFi630 will detect that the socket is broken and timeout/reset the socket.
Is this possible? How do you solve this problem?

Edit:
Going to the Admin-page->Serial setting->Serial Port->Save will make the tcp socket to work again without restarting the system. Not that useful thou :confused:

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