---
title: "Automatic reconnection to a TCP server"
url: "https://maker.wiznet.io/forum/11772"
markdown_url: "https://maker.wiznet.io/forum/11772/md"
type: "Forum topic"
category: "Wireless"
author: "phil31"
created: "2016-04-02T20:14:51+09:00"
last_activity: "2017-05-04T08:38:36+09:00"
language: "en"
views: 1100
replies: 4
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Automatic reconnection to a TCP server

## Question

Asked by phil31 on 2016-04-02 in Wireless.

Dear,

in my application, i manage a PUSH TCP function.
i successful run the TCP client on the WIZIFI250 module and connect to my TCP server. i can send my PUSH frame when required.

but sometime, the TCP server go down, or the WIFI link or maybe the TCP client of the module … don’t know exactly which one is the issue.
maybe a timeout on the server side which disconnect the client ?..

i would like to know if there is any configuration i can do, to automatically re connect or try re connection until the link is ok ?

thanks for any tips
regards

## Replies

### Reply 1 by wizdaniel, 2016-04-05

Hi

Please refer to the following link and check AT+FSOCK=6, 8

[wizwiki.net/wiki/doku.php?id=pro … t#at_fsock](http://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250pg:start#at_fsock)

### Reply 2 by phil31, 2016-04-05

hello Daniel,

please explain me a little more this command !..?
where i can specify which socket to apply ?

in my application, i have several sockets open… :
1 TCP server to serve a web server
1 TCP client to send PUSH frames
and several UDP socket to different features !

thanks, regards
Phil

### Reply 3 by wizdaniel, 2016-04-11

Hi phil

Sorry, This function can support just 1 socket.
because this function recreate the socket using saved in flash memory(scon=s)
and the SCON=S command can overwrite the socket information in the flash memory. So, just 1 socket will be saved.

You can use Recreate socket or Reset the module when there is no socket connected using the following commands.

AT+WSET=~~~~(your configuration)
AT+WSEC=~~~~(your configuration)
AT+WNET=~~~~(your configuration)
AT+WJOIN

AT+SCON=SO,5000,0 &lt;&lt;&lt; as you know, the tcp server socket will create as 5000 port and saved flash memory.

AT+FSOCK=6,10 &lt;&lt; you can choose FSOCK=6 or FSOCK=8. // FSOCK=6,10 &lt;&lt; Check the Socket connected every 10 seconds. If disconnected, recreate the saved socket once again.(TCP Server 5000 port)
AT+FSOCK=8,30 &lt;&lt; FSOCK=8,30 &lt;&lt; Check the socket connected every 30 seconds, if disconnected, Reset the module and create the TCP Socket(5000 port)

AT+MPROF=S &lt;&lt; previous commands must be saved.

### Reply 4 by phil31, 2016-04-12

well not sure to right understand …

> AT+FSOCK may support only 1 socket …

==> which one is “supported” if several socket are open ?

anyway, this AT command seem not the right solution for my problem.

regards

---

Source: https://maker.wiznet.io/forum/11772
