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 8631659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:14:54+00:00 2026-06-12T09:14:54+00:00

Original Question I am connecting to a node.js TCP server (on localhost) with telnet

  • 0

Original Question

I am connecting to a node.js TCP server (on localhost) with telnet and I am trying to explore keep-alive probes.

As a first test, I would like to connect to the server with telnet and kill the telnet session in a way that does not send a FIN packet. (Letting the server think the TCP socket is still ‘healthy’.) Unfortunately I can’t seem to find a clever way of testing this.

  • When I quit telnet from the telnet prompt, the socket’s end event fires in node. It clearly got a FIN packet.
  • When I kill telnet’s process, it also cleanly quits the connection with a FIN packet, before the process dies.

Do you know of a way to quit telnet without sending a FIN packet (preferably not involving a network cable that’s disconnected / producing a physical networking fault.)

Improved question

I want to simulate a network fault using just localhost / loopback (without actually disconnecting any interfaces / network cables). I want to open a TCP connection between a client and a server, both on localhost. Then I want the client to "die" without letting the server know that it’s gone. (I.e. without sending a FIN packet.) This could happen in a real network, if a router goes down, for example.

Thanks to the comments below, I’ve learned that the kernel will collect any open ports/sockets owned by a process when the process dies (or is forcefully killed), like my telnet above, and will close them for the process by sending a FIN packet. So I need to trick the kernel into not closing an existing connection.

So how can I create a client process, keep it alive, but let it behave like a completely dead TCP connection?

Spoilers

  • (Answer 1 below: Use a raw socket (scapy), let it ignore any packets sent by the server after the initial connection & some test data. (After a certain time, for example.))
  • (Answer 2, Idea from colleague: configure iptables to cut off traffic between client and server. Actual iptables rule in comment below.)
  • 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-12T09:14:55+00:00Added an answer on June 12, 2026 at 9:14 am

    Do you have to kill the client process? If so, just use netcat and let the processes run in the background. In bash:

    for i in $(seq 5) do nc localhost 5001 &; sleep 1; done
    

    This creates 5 TCP clients, with SYNs spaced 1 second. If you need to interact with one of the sessions, you can use

    fg $PID
    

    to return one of the netcat’s back to the shell foreground.

    Another option is an iptables rule:

    iptables -A OUTPUT -p tcp --tcp-flags FIN -j DROP
    

    Yet another option is to use a low level networking tool with raw sockets, such as Scapy. Here’s the Python Documentation for Scapy. You’ll be doing something similar to TCP SYN scanning, except you need to ACK the SYN-ACK that the server gives you. This will leave the server socket in a “connected” state and you can go on and do other things. The server may ACK you occasionally, but your test program won’t care. It will only send SYNs and respond to SYN-ACKs

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

Sidebar

Related Questions

First, here's my original question that spawned all of this . I'm using Appcelerator
Original question: Note: Below plugin pattern based on the official jQuery docs . I'm
Original Question: i read that for RESTful websites. it is not good to use
Original question: The polysemy of a word is the number of senses it has.
My original question can be found here , for which I've gotten some great
Edit: original question below, but I revise it now that I have some code
Jeff Atwood asked the original question about parameterizing a SQL IN clause , but
This question is sort of a follow-up to my original question here . Let's
This question relates to my answer of another of my question. The original question
This is a continuation of this question: Original Question (SO) The answer to this

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.