The following are the scenarios to be tested by the Duplicate Socket Stress Application (duptest). The scenarios may involve one or more of the following processes:

		ParentServer	   <--------------->	ParentClient

		/   | 	\				  /   |	  \			

ChildServer1	...	ChildServerM	<---->	ChildClient1	... ChildClientN


Scenario #1: 
------------

Friendly Name: 
single-sided-duplication-with-recv()-in-lock-step-on-single-socket-with-single-startup

Does ParentClient duplicate: No 

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 1

Single or Multiple calls to WSAStartup/WSACleanup: Single

Sequence of Operations:

	1. ParentClient connects to ParentServer
	2. ParentServer accepts connection and duplicates accepted socket and hands off to ChildServer1
	3. ParentClient sends X bytes of data to ChildServer1
	4. After ChildServer1 successfully receives all the X bytes, it 		acknowledges by sending X bytes of data to ParentClient
	5. After doing this, ChildServer1 polls for socket closure by checking if recv() returns 0.
	6. ParentClient receives X bytes of data and then closes the socket
	7. ChildServer1 gets 0 returned by recv() and closes the socket 
	8. Afterwards, ParentServer closes the socket.

	This sequence is repeated.



Scenario #2: 
------------

Friendly Name: 
single-sided-duplication-with-recv()-in-lock-step-on-single-socket-with-multiple-startup

Does ParentClient duplicate: No 

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 1 

Single or Multiple calls to WSAStartup/WSACleanup: Multiple

Sequence of Operations: 

	Same as for Scenario #1, except that WSAStartup and WSACleanup are called
before and after processing each duplicated socket on ChildServer1.


Scenario #3:
------------

Friendly Name: 
single-sided-duplication-with-recv-in-lock-step-on-multiple-distinct-sockets

Does ParentClient duplicate: No 

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 2 or more

Single or Multiple calls to WSAStartup/WSACleanup: Multiple

Sequence of Operations:

	1. ParentClient connects to ParentServer
	2. ParentServer accepts connection and duplicates accepted socket and hands off to ChildServer1
	3. ParentClient sends X bytes of data to ChildServer1
	4. After ChildServer1 successfully receives all the X bytes, it 		acknowledges by sending X bytes of data to ParentClient
	5. After doing this, ChildServer1 polls for socket closure by checking if recv() returns 0.
	6. ParentClient receives X bytes of data and then closes the socket
	7. ChildServer1 gets 0 returned by recv() and closes the socket 
	8. Afterwards, ParentServer closes the socket.

	This sequence is repeated.


Scenario #4:
------------

Friendly Name: double-sided-duplication-with-eventselect-on-multiple-distinct-sockets 

Does ParentClient duplicate: Yes

Does ParentServer duplicate: Yes

Number of ChildClients:	1 or more

Number of ChildServers: 1 or more

Single or Multiple calls to WSAStartup/WSACleanup: Multiple

Sequence of Operations:

	1. ParentClient connects to ParentServer
	2. ParentServer accepts connection and duplicates accepted socket.
	3. Similarly ParentClient duplicates the connected socket
	4. Both ParentClient and ParentServer try to hand off the connected/accepted socket to any one of their idle children. If there are no children idle, then they wait until one becomes available and then hand-off and continue with the next socket.
	5. Each Child (whether it is ChildServer or ChildClient) processes the duplicated socket in an identical way as follows:
	6. Child does a WSAEventSelect for FD_READ, FD_WRITE, FD_CLOSE events.
	7. Whenever a FD_WRITE is signalled, the Child keeps sending data until it completes the sending of the given X bytes of data or until it receives WSAEWOULDBLOCK. 
	8. Whenever a FD_READ is signalled, the Child receives the data in small chunks.
	9. The Child repeats this until either the socket is closed or until the specified number of bytes are sent and received successfully.
	10. Then the Child closes the socket and reports status to the parent.
	11. Afterwards, ParentServer closes the socket.

	This sequence is repeated.



Scenario #5:
------------

Friendly Name: 
single-sided-duplication-with-recv-on-multiple-shared-sockets-with-single-startup

Does ParentClient duplicate: No

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 2 or more

Single or Multiple calls to WSAStartup/WSACleanup: Single

Sequence of Operations:

	1. ParentClient connects to ParentServer
	2. ParentServer accepts connection 
	3. ParentServer duplicates and hands off the same connected/accepted socket simultaneously to ALL the children. If it can't get all the children in the idle state it waits until that condition happens and then hands-off.
	4. ParentClient sends X bytes and closes the socket and goes back to Step 1 and proceeds with the next socket.
	5. Each ChildServer processes the duplicated socket in an identical way as follows:
	6. ChildServer does a recv() and receives data.
	7. ChildServer keeps doing this until recv() returns 0 or WSAECONNRESET or WSAECONNABORTED
	8. Then the ChildServer closes the socket and reports status to the parent.
	9. After the ParentServer has successfully received the status report from each of the ChildServers, it finally closes the socket.

	This sequence is repeated.

Scenario #6:
------------

Friendly Name: 
single-sided-duplication-with-recv-on-multiple-shared-sockets-with-multiple-startup

Does ParentClient duplicate: No

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 2 or more

Single or Multiple calls to WSAStartup/WSACleanup: Multiple

Sequence of Operations:

	Same as for Scenario #5, except that WSAStartup and WSACleanup are called
before and after processing each duplicated socket on ChildServers.


Scenario #7:
------------

Friendly Name: 
double-sided-duplication-with-eventselect-on-multiple-distinct-sockets-with-rsvp-provider

Does ParentClient duplicate: Yes

Does ParentServer duplicate: Yes

Number of ChildClients:	1 or more

Number of ChildServers: 1 or more

Single or Multiple calls to WSAStartup/WSACleanup: Multiple

LSP's CatalogEntryId = 1005

Sequence of Operations:

	Same as Scenario #4 except that the LSP is RSVP TCP Service Provider instead of the default provider.


Scenario #8: 
------------

Friendly Name: 
single-sided-duplication-with-listening-parent-and-accepting-child-with-single-startup

Does ParentClient duplicate: No 

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 1

Single or Multiple calls to WSAStartup/WSACleanup: Single

Sequence of Operations:

	1. ParentServer does a listen on a new socket and then duplicate the socket
	2. ChildServer does a accept
	3. ParentClient connects to ChildServer
	3. ChildServer sends X bytes of data to ParentClient and closes the socket.
	4. ParentClient receives all the data and closes both listening and 
	accepted socket.
	5. ParentServer closes its socket.

    This sequence is repeated.


Scenario #9: 
------------

Friendly Name: 
single-sided-duplication-with-parent-server-sending-data-after-child-closes-socket

Does ParentClient duplicate: No 

Does ParentServer duplicate: Yes

Number of ChildClients:	0

Number of ChildServers: 1

Single or Multiple calls to WSAStartup/WSACleanup: Single

Sequence of Operations:

    1. ParentServer accepts a socket connection from ParentClient.
    2. ParentServer duplicates the accepted socket and hands over to ChildServer 
    3. ChildServer sends X bytes of data to ParentClient and then closes 
       the socket.
    4. Then, ParentServer sends X bytes of data to ParentClient and then closes
       the socket.
    5. ParentClient closes its socket finally.

    This sequence is repeated.
		
