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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Keeping socket connections alive

Keeping socket connections alive

Scheduled Pinned Locked Moved Visual Basic
questionsysadminhelp
3 Posts 2 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.
  • M Offline
    M Offline
    Mariano Capezzani
    wrote on last edited by
    #1

    Hi all, I have a server application awaiting incoming connections through a series of sockets set in "listen" mode. I have a number of client applications in remote locations that communicate via tcp/ip, opening the corresponding socket connection to the server and transmitting data. The problem I have is that the client-to-server socket connections seem to die out after a while, specially in locations where internet is intermittent. When this happens, the connection does not terminate, rather it stays in "connected" state, but data transfer is lost in the web. Even though the winsock.state = sckConnected, the data is not received. In order to solve this, I implemented a refresh timer, that closes and reopens all sockets in the server once every n seconds. It works, but it's terribly unelegant. I have found no other way of doing this, keeping the connections alive. Anybody could please give me a suggestion on how this can be done properly? How can I determine if a connection is alive or dead, regardless of what .state says? Thanks, Regards.

    R 1 Reply Last reply
    0
    • M Mariano Capezzani

      Hi all, I have a server application awaiting incoming connections through a series of sockets set in "listen" mode. I have a number of client applications in remote locations that communicate via tcp/ip, opening the corresponding socket connection to the server and transmitting data. The problem I have is that the client-to-server socket connections seem to die out after a while, specially in locations where internet is intermittent. When this happens, the connection does not terminate, rather it stays in "connected" state, but data transfer is lost in the web. Even though the winsock.state = sckConnected, the data is not received. In order to solve this, I implemented a refresh timer, that closes and reopens all sockets in the server once every n seconds. It works, but it's terribly unelegant. I have found no other way of doing this, keeping the connections alive. Anybody could please give me a suggestion on how this can be done properly? How can I determine if a connection is alive or dead, regardless of what .state says? Thanks, Regards.

      R Offline
      R Offline
      rprateek
      wrote on last edited by
      #2

      are you using win sock . I had the similar problem before using win sock where i lost data even the client was connected with the server. But later i used dart sock and it helped me you can get the trial version of these from www.dart.com and try it out, hope this would help you.

      Blog for Programmers

      M 1 Reply Last reply
      0
      • R rprateek

        are you using win sock . I had the similar problem before using win sock where i lost data even the client was connected with the server. But later i used dart sock and it helped me you can get the trial version of these from www.dart.com and try it out, hope this would help you.

        Blog for Programmers

        M Offline
        M Offline
        Mariano Capezzani
        wrote on last edited by
        #3

        Yes, I use winsock. Thanks for the tip!!, but I think I might have solved temporally in a rather clumsy way. I set up each client to "ping" the server every second. The server "pongs" to each "ping". I there is no "pong", the connection is down and a reconnect is issued. This check is performed at both sides. Unelegant, but it works, and it´s free... Has anybody implemented a different type of "keep alive" mecanism? Regards,

        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