3

I have some software that will disconnect itself from the main server if activity in the program goes idle. From my understanding, I need to intercept some for of heartbeat packet or something and then replicate and send it every couple of seconds. I need to make this a fully separate program (I have to give it to some others in the office and things like WireShark won't solve my issue).

We are trying to run large processes through the program, but, unless we stay on constantly in the program, even if it's running something, it will disconnect.

I'm using .net, specifically VB.net, (I can convert c# most of the time).

Thanks if you can!

Freesnöw
  • 30,619
  • 30
  • 89
  • 138

1 Answers1

0

Could you run a background thread as soon as you establish a connection and ping your server every so often to prevent the disconnect? Something like this (C#):

 class KeepAlive
 {
    public void KeepAliveAsync()
    {
      Thread thread = new Thread(DoPing); 
      thread.Start();
    }

    private void DoPing()
    {
      Ping ping= new Ping ();
      PingReply reply = ping.Send ("www.example.com");

      if(reply.Status != IPStatus.Success)
      {
         // lost connection
      }
    }
 }

Or if a ping doesn't work, whatever the equivalent of an empty packet is.

By the way, even if it compiles, don't use that in production code, it is just an example.

satnhak
  • 9,407
  • 5
  • 63
  • 81
  • This is url pinging though isn't it? The heartbeats or whatever the program uses are in packet for, I think. I would need to capture one to understand what it is and then send it back. Right? – Freesnöw Apr 15 '11 at 17:08