SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By rgelb
#118192
I am able to read an HTTP request and now I want to respond to it. From what I understand, after sending back a response (e.g. HTTP headers and an HTML page), I am supposed to close the TCP connection.

Do I drop into command mode, manually close the connection and then back to data mode?
Or is there a better way of doing it.
By chrisjp
#119050
You may have figured out a solution already, but a great was to control opening and closing connections without dropping into command mode is to use the optional GPIO modes.

GPIO-6 used to represent the connection status.

GPIO-5 is used to toggle the connection open and closed.

See the user guide section 10.5.2.
Code: Select all
<2.20> set ip host <addr>	// set the IP address of the remote host 
<2.20> set ip remote <port> // set the IP port of the remote host 
<2.20> set sys iofunc 0x60	// set alternate function for GPIO-5 and GPIO-6 
<2. 20> save 
<2. 20> reboot	// the module must be rebooted for the alternate settings to take effect
"On the remote host run your application or other software that opens and listens on the <port>.
Connect GPIO-5 to your embedded processor or other control signal. When GPIO-5 is driven high a connection will be attempted. When drive low the connection will be closed. Be sure to not to drive the GPIO with more that 3.3 VDC or permanent damage to the module will occur."
By follower
#119625
chrisjp wrote:GPIO-6 used to represent the connection status.
Interesting, I hadn't noticed that functionality previously. Have you used this with a bare WiFly module (as opposed to the Arduino Shield)? I'm curious if this only works for the "HTTP" functionality built into the module or if it also works for manually opened connections.

--Philip;