User Tools

Site Tools


products:wiz550s2e:wiz550s2e_tutorial_en:exam2

Exam 2. Example of retrieving web page of www.google.com in Dynamic IP and TCP Client mode


1. Set WIZ550S2E with Dynamic IP

Set WIZ550S2E with Dynamic IP.

<TX> AT+NSET=D\r\n
<RX> [S]\r\n

If you check with AT+NSTAT command after above command, you can get response like below.

<TX> AT+NSTAT\r\n
<RX> [S,,D,192.168.3.101,255.255.255.0,192.168.3.1,168.126.63.1]\r\n


2. Get IP address of www.google.com

Obtain IP address of www.google.com by DNS function like below command.

<TX> AT+FDNS=www.google.com\r\n
<RX> [S,,173.194.126.168]\r\n


3. Connect to google web server

Make TCP Client socket to connect to google.com.
AT+NOPEN needs Server's IP address not Domain name, so you should put IP address which you got by above command AT_FDNS
You can see that local port number was not written.
If you don't write local port number, local port number will be allocated dynamically by WIZ550S2E.

<TX> AT+NOPEN=C,,173.194.126.168,80\r\n
<RX> [W,0]\r\n[S,0]\r\n

You can check the current status of the socket which you made with AT+NSOCK. Below is an example of it.

<TX> AT+NSOCK=0\r\n
<RX> [S,,C,2014,173.194.126.168,80]\r\n


4. Send data to google web server

Let WIZ550S2E send 18 bytes data to google.com with below command

<TX> AT+NSEND=0,18\r\nGET / HTTP/1.1\r\n\r\n
<RX> [W,0]\r\n[S,0]\r\n


5. receive data from google.com

If WIZ550S2E receives data from google.com, you can know its data size and data like below.

<RX> [R,0,523]\r\nHTTP/1.1 302 Found\r\nCache-Control: private\r\nContent-Type: text/html; charset=UTF-8\r\n..............


6. Disconnect current TCP connection

Do send command like below to disconnect current connection.

<TX> AT+NCLOSE=0\r\n
<RX> [W,0]\r\n[S,0]\r\n
products/wiz550s2e/wiz550s2e_tutorial_en/exam2.txt · Last modified: 2015/03/16 10:33 (external edit)