Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:00:05+00:00 2026-06-08T07:00:05+00:00

So in a nutshell, I have server set up using tcplistener / tcpclient, and

  • 0

So in a nutshell, I have server set up using tcplistener / tcpclient, and it has a couple dozen client machines. Everything is working well, except that I do not yet have a system set up to detect whether or not a client has disconnected. I would like to use heartbeats (periodically sent packets) to show the client is still there. Unfortunately, what is happening is that the server has a waiting receive block called so that it can get actual data from the clients, but it is receiving the heartbeats instead. Is there any way I can set up another receive on the same port that is looking specifically for heartbeats? -Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:00:09+00:00Added an answer on June 8, 2026 at 7:00 am

    One common way is to define your packets to have a specific type, therefore the server packet receiving code can just check the type and deal with it appropriately.
    i.e.

    if ( packet.type == PacketTypes.HeartBeat )
        //keep alive the client
    else
        //it's data (or another packet)
    

    When you add your code I can give a better example.

    UPDATE:

    As per our discussions in the comments, you can simply create a separate thread for dealing with your heartbeat packets. In this thread, your socket receive code will ignore anything but heartbeat packets by first checking the type.

    You can also create another thread housing a socket receive on the same port to deal with your data. In this case, it would just ignore any heartbeat packets received.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a nutshell, I have a solution that builds fine in the IDE, and
My controller, in a nutshell is this: chart1.SeriesCollection.Add(SC); using (MemoryStream ms = chart1.GetChartStream()) {
I'm using a jQuery plugin called Tablesorter to do client-side sorting of a log
i have came across the sentence in a nutshell while reading a technical book
In a nutshell , I want to have different faces for some types of
I have wrote a web service, in a nutshell it uses openpop to get
I have this code copied from C# 4.0 in a nutshell that uses Attribute/Reflection
I have a rails time-based query which has some odd timezone sensitive behaviour, even
I am working on a database and all the tables have plural names. What
I am writing a Smooth Streaming client application. On the server side (IIS 7

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.