4.1.2 Connecting to a RunspacePool

The typical PowerShell Remoting Protocol sequence for successfully connecting to an existing RunspacePool on the server is shown in the following table.

Step

Client

Direction

Server

1

The client initializes the RunspacePool state to Connecting (see section 3.2.1.2.2). The client connects with the server using a wxf:Connect message (see section 3.1.5.3.14) that includes the SESSION_CAPABILITY and CONNECT_RUNSPACEPOOL messages.

>

The server processes the message and validates the ProtocolVersion (see section 3.1.5.3.14).The server processes the CONNECT_RUNSPACEPOOL message. The server sets the RunspacePool state (section 3.2.1.2.2) to Connecting.

2

<

The server sends a success message (see section 3.2.5.3.15) along with the server's negotiation information and the RUNSPACEPOOL_INIT_DATA message, if validation succeeds.

3

The client processes the server's Session Capability object and, if successful (as described in section 3.2.5.4.1), takes the following actions:

  • The client changes the RunspacePool state (see section 3.2.1.2.2) to NegotiationSucceeded.

  • The client processes the RUNSPACEPOOL_INIT_DATA message and changes the RunspacePool to Opened.

  • The client issues a wxf:Receive request to the server.

>

4

<

The server uses a wxf:ReceiveResponse message (see section 3.2.5.3.8) to send an APPLICATION_PRIVATE_DATA message (see section 3.2.5.4.13). The server changes the RunspacePool state to Opened.

5

The client receives the APPLICATION_PRIVATE_DATA message and passes it to the higher layer.