thisbe
October 5, 2014, 11:31am
1
Hi
I’m sending requests to a REST API whenever the user presses a button. This could be once in a few hours or multiple times per second. I’m having issues with the latter case at the moment, since client.stop() seems to take almost 1.5 seconds to return. Why is that?
Hmmmm… It shouldn’t be…
Pretty simple function here:
/**
******************************************************************************
* @file spark_wiring_tcpclient.cpp
* @author Satish Nair
* @version V1.0.0
* @date 10-Nov-2013
*
* Updated: 14-Feb-2014 David Sidrane <david_s5@usa.net>
* @brief
******************************************************************************
Copyright (c) 2013 Spark Labs, Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
This file has been truncated. show original
How did you time it?
thisbe
October 5, 2014, 11:44am
3
I timed it with millis()
. Actually I timed within the stop method too and it’s indeed closesocket()
that takes so much time.
Seems like a blocking issue with the CC3000
/*****************************************************************************
*
* socket.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Updated: 14-Feb-2014 David Sidrane <david_s5@usa.net>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
This file has been truncated. show original
thisbe
October 6, 2014, 7:43am
5
I suspect that since the socket is in blocking mode, it will wait for the whole FIN/ACK sequence to complete on the CC3300 side before it returns. Maybe I can set it to non-blocking just before I close it.