No announcement yet.

TCP-Connect behaviour

  • Filter
  • Time
  • Show
Clear All
new posts

  • TCP-Connect behaviour

    i'm integrating our own application into the MatchPort Pro and use a tcp socket to exchange data with a host.

    If the device is started after being off some time the TCP Connection setup is instantly successfull. If a coldboot is done in this condition, after the reboot the connection setup takes a long time.

    It seems that the device has the socket-timeout from the last successful connection in memory.

    How can i change this behaviour to connect instantly in every situation after the device booted?

    tcpClientSock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP)
    ->>>> if(connect(tcpClientSock, (struct sockaddr *)&remote_tcp_addr,
    sizeof(remote_tcp_addr)) != 0) {
    SerialWrite(0, "no connection\r\n",5,true);

  • #2
    additional comment

    sorry. the line

    SerialWrite(0, "no connection\r\n",5,true);

    should look like that

    SerialWrite(0, "no connection\r\n",15,true);

    but is not related to my problem.

    Best regards


    • #3
      Put a sniffer on it - it's very likely the peer you are connecting to and not the MatchPort-AR. If one network peer attempts to connect to another on an "already used" socket, it is likely that the peer will reject the second attempt untill the final FIN wait time elapsed. It is likely that the MatchPort is using the same source port number and hense the problem...