Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Socket Problems

Socket Problems

Scheduled Pinned Locked Moved .NET (Core and Framework)
sysadminquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    J Holzer
    wrote on last edited by
    #1

    Hello! I have a TCP/IP-Server, that listens for connections from a electronic device. The device connects to the server and the server build another IP-Connection to the electronic. It may happen, that the electronic has to reboot and cannot close the connection properly. The server has a connection-watchdog, that checks when the last message came in from the electronic and tries to close the connection if the electronic didn´t send a message since a certain time. Since the electronic cannot answer this close-request the connection seems to remain open, at least that´s what "netstat" tells me ("Wait for FIN", or "Last message was ACK"). Also it may happen, that the electronic tries to connect again, but then the server send´s just an "ACK" instead of "SYN/ACK", what makes the electronic retry to open the connection with "SYN". (Traced with WireShark) Is there a way to force the closing the connection, clear the open/waiting ports and enable the server to accept a new connection from the same electronic on the same port from the same IP? Thanks J.

    M L 2 Replies Last reply
    0
    • J J Holzer

      Hello! I have a TCP/IP-Server, that listens for connections from a electronic device. The device connects to the server and the server build another IP-Connection to the electronic. It may happen, that the electronic has to reboot and cannot close the connection properly. The server has a connection-watchdog, that checks when the last message came in from the electronic and tries to close the connection if the electronic didn´t send a message since a certain time. Since the electronic cannot answer this close-request the connection seems to remain open, at least that´s what "netstat" tells me ("Wait for FIN", or "Last message was ACK"). Also it may happen, that the electronic tries to connect again, but then the server send´s just an "ACK" instead of "SYN/ACK", what makes the electronic retry to open the connection with "SYN". (Traced with WireShark) Is there a way to force the closing the connection, clear the open/waiting ports and enable the server to accept a new connection from the same electronic on the same port from the same IP? Thanks J.

      M Offline
      M Offline
      Mark Churchill
      wrote on last edited by
      #2

      Yikes. No way to configure the device to use something easier like UDP? Going to be a massive pain to hook that deep into the network stack :/

      Mark Churchill Director Dunn & Churchill Free Download:
      Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.

      J 1 Reply Last reply
      0
      • M Mark Churchill

        Yikes. No way to configure the device to use something easier like UDP? Going to be a massive pain to hook that deep into the network stack :/

        Mark Churchill Director Dunn & Churchill Free Download:
        Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.

        J Offline
        J Offline
        J Holzer
        wrote on last edited by
        #3

        Unfortunately not. We do not have access to the electronic´s firmware, so we cannot change the protocol in any way...

        1 Reply Last reply
        0
        • J J Holzer

          Hello! I have a TCP/IP-Server, that listens for connections from a electronic device. The device connects to the server and the server build another IP-Connection to the electronic. It may happen, that the electronic has to reboot and cannot close the connection properly. The server has a connection-watchdog, that checks when the last message came in from the electronic and tries to close the connection if the electronic didn´t send a message since a certain time. Since the electronic cannot answer this close-request the connection seems to remain open, at least that´s what "netstat" tells me ("Wait for FIN", or "Last message was ACK"). Also it may happen, that the electronic tries to connect again, but then the server send´s just an "ACK" instead of "SYN/ACK", what makes the electronic retry to open the connection with "SYN". (Traced with WireShark) Is there a way to force the closing the connection, clear the open/waiting ports and enable the server to accept a new connection from the same electronic on the same port from the same IP? Thanks J.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          J. Holzer wrote:

          the server build another IP-Connection

          Have you looked at the documentation for Winsock2[^]? Things like calling setsockopt for SO_KEEPALIVE can return errors when the connection is down.

          led mike

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups