Skip to main content
hector
Associate II
April 29, 2015
Question

Custom socket usage

  • April 29, 2015
  • 3 replies
  • 785 views
Posted on April 29, 2015 at 09:26

Hi,

I'm trying to use custom socket with two SPWF01SA, but I'm having some troubles:

-I can't find the documentation, to know how it works exactly

-I have a creepy behavior once I try to send data from server to client

I have disabled the standard HTTP socket on port 80 (TCP) and I have set up my own on the same port. Then the server waits the WIND:61 indication (incoming socket) to send the following text through the UART:

 ''HTTP/1.1 200 OK  - HTTP version as in GET\r\n''

''Content-type: text/html\r\n''

''Content-length:15\r\n''

''\r\n''

''<html>_|_<html>''

I use the other  SPWF01SA as a client and after a wi-fi association I use ''AT+S.HTTPGET=172.20.146.1,/index.html\r'' expecting the previous text, but instead I receive:

''t-type: text/html

ersion as in GET

Content-length:15

html

ersion as in GET

ntent-length:15

html

ersion as in GET

<html>_|_<html>15

html

ersion as in GET

[1A][1A][1A]''

Am I doing something wrong? And where can I find the documentation on sockets?

Regards,

Hector

    This topic has been closed for replies.

    3 replies

    Gerardo GALLUCCI
    ST Employee
    April 29, 2015
    Posted on April 29, 2015 at 12:34

    Hi,

    I did the same attempt, but I have good results.

    Module 1 - server:

    - turn off web server - at+s.httpd=0

    - turn on socket server - at+s.sockd=80

    Module 2 - client:

     - request resource - at+s.httpget=_ip_,_res_

    Module 1 output:

    <CR><LF>

    +WIND:61:Incoming Socket Client:192.168.1.126<CR><LF>

    <CR><LF>

    +WIND:60:Now in Data Mode<CR><LF>

    GET / HTTP/1.0<CR><LF>

    User-Agent: SPWF01SA1<CR><LF>

    Host: 192.168.1.104<CR><LF>

    Connection: close<CR><LF>

    <CR><LF>

    <CR><LF>

    +WIND:59:Back to Command Mode<CR><LF>

    <CR><LF>

    +WIND:62:Socket Client Gone:192.168.1.126<CR><LF>

    Module 2 output:

    at+s.httpget=192.168.1.104,/

    ERROR: nothing received, increase ip_http_get_recv_timeout variable

    ************************ OR **************************

    Module 1 output:

    <CR><LF>

    +WIND:61:Incoming Socket Client:192.168.1.126<CR><LF>

    <CR><LF>

    +WIND:60:Now in Data Mode<CR><LF>

    GET / HTTP/1.0<CR><LF>

    User-Agent: SPWF01SA1<CR><LF>

    Host: 192.168.1.104<CR><LF>

    Connection: close<CR><LF>

    <CR><LF>

    29-Apr-15 12:31:43 [TX] - 12345678

    29-Apr-15 12:31:46 [RX] - <CR><LF>

    +WIND:59:Back to Command Mode<CR><LF>

    <CR><LF>

    +WIND:62:Socket Client Gone:192.168.1.126<CR><LF>

    Module 2 output:

    at+s.httpget=192.168.1.104,/

    12345678

    OK - 21800 - 10 - 329

    Is this what you are trying to do?

    hector
    hectorAuthor
    Associate II
    April 29, 2015
    Posted on April 29, 2015 at 13:41

    I'm trying to do the same thing yes. I do receive something but the sentences are all mixed up...

    Thanks for the quick answer again :)

    Gerardo GALLUCCI
    ST Employee
    April 29, 2015
    Posted on April 29, 2015 at 13:48

    Debug your host application...

    jerry