TCP channel problem

I’m experiencing a problem when trying to open a TCP channel.
For example, let’s consider the following line:

status,ch=try(wip.tcp_client,“www.google.com”,80)

Let’s suppose the server is shut down and the wip.tcp_client() function fails throwing a “REFUSED” error.
In this case status will be ‘false’ and ‘ch’ will contain the error.
This is the expected behavior, but the channel somehow remains open - it shows up in ‘proc.channels’ as ‘busy’.
There is no way to close this channel because there is no handle to it - the wip.tcp_client() function in this case returns nil.
The only way for me to close the channels is to have a sepparate thread that parses proc.channels and closes all the busy ones,
but I think that’s a bit too complicated don’t you agree ? There is a limit of how many channels can be opened at the same time,
and reaching that limit is just a matter of minutes.

Am I missing something here ?

Thanks,
Alex

This resource leak has been found and fixed in revision 86-87 (22/10/09). Are you using a version older than that?

I’m using the 1.1.0.2010 Lua package that came with M2M studio - I’m not sure which svn revision it corresponds to. Is it different than revision 97 that can be found here:
https://svn.anyware-tech.com/wavecom/openat-lua/trunk/oatlua/

Thanks,
Alex

It’s a very old version, I’d say december 2008 IIRC. Due to organizational issues, we struggled to maintain the plug-in distributed with Oasis up-to-date.

  • In the very short term, you should work with the svn version (you can use it to build a separate lib project and link it, or include it straight into your application; just don’t forget to include source files in the build path, with right-clic / uncheck “exclude from build”).
  • In the relatively-short-but-not-that-short term, now that the studio supports SPM package management, we’ll be able to keep the Lua plug-in updated regularly.

Sorry for the inconvenience…

I managed to build and use the latest LUA library and indeed the TCP channel problem seems to be fixed.

Thanks for the help
Alex

I am using wip.tcp_client and TCPconn:write(…) function to send data from the modem to server connect to gsm provider.
The connection working and all ok but some time the write func fail and the data is stay on modem site.
I trying to find why And I think I need some help.

This is the error I receiving during communication to the server.

I will have to notice that there is another task that run and wait for command from the server like Reset,ping
and this command working and after receiving the command the modem send ack with the save fun :write(…) and it work.

Please advice why the write function inside channels_lua.lua in src-lua is endless loop, why after find that there is error it not return back?

Please advice how can I find the problem and how can i change lua debug log to see this error from write function.
thx.