Sohag Mony
Sohag Mony

Reputation: 735

Simultaneous open tcp connection using winsock api

Is it possible to implement Simultaneous open tcp connection in c++ . For your kind information i am giving reference of Simultaneous open tcp connection below

http://ttcplinux.sourceforge.net/documents/one/tcpstate/tcpstate.html

Upvotes: 1

Views: 476

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598001

Based on that state diagram, I see two possibilities:

1) both parties are calling connect() at the same time. Since this requires knowing both IP/Port pairs ahead of time, both parties would have to bind() to specific IP/Port pairs and then exchange that info with each other (if not hard-coded) before calling connect().

2) one party is calling listen() and then sendto() with the listening socket while the other party is calling connect() at the same time after calling bind().

Either condition is not common in socket programming. You never have two clients connect()'ing to each other, and you rarely if ever send data on a listening socket, you wait for accept() to return an established endpoint first and then you send data with that instead.

Upvotes: 1

Related Questions