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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:53:43+00:00 2026-05-13T17:53:43+00:00

Consider the three way handshake of TCP. It is explained here . Now the

  • 0

Consider the three way handshake of TCP. It is explained here.

Now the article above mentions that two sides may try to connect simultaneously and the three way handshake works fine in this case.

Can we simulate this situation using the sockets api.
what we usually code using sockets is a passive open(server) and an active open(client)?

  • 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-05-13T17:53:44+00:00Added an answer on May 13, 2026 at 5:53 pm

    It is possible to cause a simultaneous TCP open using the sockets API. As Nikolai mentions, it is a matter of executing the following sequence with a timing such that the initial SYNs cross each other.

    bind addr1, port1
    connect addr2, port2
    bind addr2, port2
    connect addr1, port1
    

    Here’s how I achieved a simultaneous open using a single Linux host.

    1. Slow down the loopback interface using netem

      tc qdisc add dev lo root handle 1:0 netem delay 5sec
      
    2. Run netcat twice

      netcat -p 3000 127.0.0.1 2000
      netcat -p 2000 127.0.0.1 3000
      

    The two netcat processes connect to each other resulting in a single TCP connection

    $ lsof -nP -c netcat -a -i # some columns removed 
    COMMAND   PID NAME
    netcat  27911 127.0.0.1:2000->127.0.0.1:3000 (ESTABLISHED)
    netcat  27912 127.0.0.1:3000->127.0.0.1:2000 (ESTABLISHED)
    

    Here’s what tcpdump showed me (output edited for clarity)

    127.0.0.1.2000 > 127.0.0.1.3000: Flags [S], seq 1139279069
    127.0.0.1.3000 > 127.0.0.1.2000: Flags [S], seq 1170088782
    127.0.0.1.3000 > 127.0.0.1.2000: Flags [S.], seq 1170088782, ack 1139279070
    127.0.0.1.2000 > 127.0.0.1.3000: Flags [S.], seq 1139279069, ack 1170088783
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way that you may create a puzzle of three pieces with
Background Consider the validation of three doubles low , width and high such that
Consider i am using join on three tables to get a desired result-set... Now
Consider the two following regular expression snippets and dummy HTML that it should be
Consider the code bellow. // Consider that MyObject receives three integers in it's constructor.
Consider such a map: Map(one -> Iterable(1,2,3,4), two -> Iterable(3,4,5), three -> Iterable(1,2)) I
Consider three tables: one of items, one of tags on those items, and the
Consider these three mysql statements: select * from Users; select id, title, value from
Consider the three following classes: EntityTransformer contains a map associating an Entity with a
Please consider the following three .NET types: I have an interface, an abstract class,

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.