Posts by Sener

    Hi Jannik,

    Thanks a lot for some insight, it has already given me some some idea and I've already noticed that the disconnect is slow however it is not that critical in my situation.
    Besides that, I am confused on one thing. You said

    If the connection gets lost (remove first switch while target is still connected to second switch), IP_MQTT_CLIENT_Publish() will not return -1.

    But, I get r < 0 regardless which switch is disconnected. To be more specific;

    - If the switch directly connected to my device is removed, I get r < 0 immediately by press of a button.
    - If the far switch is removed from the LAN, I get r < 0 after a certain time, say 5 seconds or so after press of a button.

    In general it is not easy to detect if another device lost its connection without sending/receiving a message

    Yeah, I get that, I might give a try to sending regular ping from an independent task and listen it back.


    Best regards,
    Sener

    Display Spoiler

    Hello Jannik,

    Thank you for your reply.

    In fact, I have already keep-alive. If it is o, can expect a callback or something to detect/register the disconnect?

    Code
    IP_SOCKET_SetDefaultOptions(0| SO_KEEPALIVE); // Keep connections alive

    The device is not constantly aware if the network is present. I have MQTT client running. And, once a while a message is being published by a button push.

    I have this routine to publish

    Code
    r = IP_MQTT_CLIENT_Publish(&MQTTClient, &Publish);
    if (r < 0) {  IP_MQTT_CLIENT_LOG(("MQTT Pub failed.")); }


    Can I simply rely on or consider if r < 0 then the connection is lost?
    (Ignore mqtt releated setting like authentication errors for a moment)

    Best regards,
    Sener

    Hello,

    My emNet version is V3.40.

    I've an issue when the network is not really there. I will explain what I mean,

    • I have minimum 2 network switches.

      • First one is connected to the local network directly.
      • Second one is a sitting between first switch and my custom PCB.
    • I power the custom PCB which has a firmware communicates with the network for several tasks.
    • I then remove the first network switch from the local network while the 2nd network switch is still connected to the custom PCB.

    At that stage, 100Mbps LED stays ON and the activity LED goes OFF or ON and stays there depends on at what state it was.
    And, all the network operation ceased naturally.

    If I directly remove the network from the custom PCB ,it is fine, I get a proper state change inside _OnStateChange event callback.
    And I can then notify the user for the issue.

    For now, I just ping an IP and wait for an answer? But, I prefer not to use it.

    I am probably missing a point when I read the document. Is there a robust way emNet can offer when the network is really disconnected.

    Best regards,
    Sener