Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Long timeout if ever. Net.FTcpSocket


Question

Posted

When I am using the above with an IP-adress it seems the vode doesnt run if the IP is not found/connectable. It seems to stop on this row:

tcpSocket = Net.FTcpSocket(_deviceIp, _devicePort);

I would have liked it to continue down to:

if errorCode == 0 then

but it seems to stop even with timeout of 250ms. Anyone else seeing this in 3.580?

local function _ping(_deviceIp, _devicePort)

tcpSocket = Net.FTcpSocket(_deviceIp, _devicePort);

tcpSocket:setReadTimeout(250);

fibaro:sleep(250);

bytes, errorCode = tcpSocket:write("ping");

tcpSocket:disconnect();

if errorCode == 0 then

return true;

else

return false;

end

end

4 answers to this question

Recommended Posts

  • 0
Posted

Try as:

Please login or register to see this code.

  • 0
  • Inquirer
  • Posted

    I tired below code in a Virtual Device on a button, but for me it never timesout. if you change to valid IP you at least get "OK"

    Please login or register to see this code.

    • 0
    Posted

    if you use for example 192.168.xxx.xxx in all case you got timeout or success BUT if you try with 192.10.xxx.xxx it never timeout if 192.10 isn't your network

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    You must use ip corresponding to your network and you can change only change here last two couple (host)

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Ex:

    192.168 . 10.10

    NETWORK HOST

    • 0
  • Inquirer
  • Posted

    aha, that explaines it. I tried to ping a computer on the internet for watching up status.

    No thanks button, to bad...

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...