MULTIPLE TCP server

Dear Everybody!

For my application I need to listen for connection on TCP port 80 and 81 (for example).

To realize this I can register two TCP server with
T+SCON=S,TSN,80,0 and T+SCON=S,TSN,81,0 .
WIzfi respond both with [OK].

If I connect to TCP server on port 81, then the connection is established on socket ref 0.
But unfortunately if I try to connect to TCP server on port 80, then connection is rejected.

Maybe Wizfi not support multiple TCP server?

Thanks for any advise, kzsolt2

Hi,kzsolt2!!

I am sorry for late reply…!!

From what I test, It works!

image

Can you do it again…??

I hope it is helpful!

Regards,
Tom

Dear Tom!

What firmware do you use?
I have a “Official Latest firmware release”.

Moreover I use “register as a Service” option, because I need to listen for two different service.

Moremoreover I use special configuration.
I use Wizfi as AP (access point), and over this I need to create two socket server.

Using this firmware looks like last AT+SCON command overwrite the only one socket server config.
This is why incomming socket to first is rejected.

kzsolt

Hi, kzsolt2

→ My WizFi250 firmware version is 1.0.4.9.

→ Yes, If you want to use a “register as a Service” mode, I couldn’t create two socket server.
I will figure it out and let you know.

What about using a “open at once” mode?
I tested WizFi250 can create two socket server like below.

image

Thanks,
Tom.

Dear Tom!

Then rise a question, what is the diffrence between “register as a Service” mode and "open at once” mode?

As linux developer I this first about register as a Service.
But maybe I wrong.

kzsolt2

Hi, kzsolt2!

I think, it will be helpful.

Thanks,
Tom.

Dear Tom!

There is the problem.

If I “register as service”, then I do not need to care for AP join or disconnect / socket connect and disconnect, Wizfi automatically open the socket server.
But if I “open at once”, then I need to monitor joined/disconnected status, and “open at once” every sucessfull AP join.

But there is more problem.
I can detect AP connection state by WSTAT polling.
But If AP restarted, then AP disapper just for short time.
For this case WSTAT polling is not works well.
This is why “register as service” is very helpful.

Moreover “open at once” open for just one connection.
If connetion are closed need to detect it and register socket again.

Best regards, kzsolt2

Dear Tom!

I test this problem with 1.0.5.2 firmware, and I got a same result (as 1.0.3.3).
If I try to open socket server on port 80 and 81, then only port 81 are responding.
The “Added TCP Server Multi Connection” of are maybe related to multi connection on a same port only.

kzsolt2

multiple connection need to be enable by “AT+FSOCK=9,1”
yes, i know … undocumented option … !

OOps :blush:

Its value depend from number of socket or from any other dependency?

kzsolt2

AT+FSOCK=9,1 enable
AT+FSOCK=9,0 disable (default)

Dear Phil!

Unfortunately does not make a sense I set FSOCK9 to 0 or 1, the result are same.
If I try to open socket server on port 80 and 81 it is success, but only port 81 are responding.
The port 80 are respond with R at TCP level.

kzsolt2