Connecting Network Stream Endpoints Together
You can connect endpoints in the following ways:
- Specify a URL in the otherEndpointURL parameter in the CNSNew...Endpoint functions.
- Pass NULL or "" to the otherEndpointURL in the CNSNew...Endpoint functions, which creates a passive endpoint.
The following table shows examples of each of these methods.
Writer Endpoint | Reader Endpoint | Notes |
---|---|---|
CNSNewScalarEndpoint ("Writer", "//10.0.0.62/Reader", CNSTypeInt32, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &writerEndpointID); | // Passive endpoint CNSNewScalarEndpoint ("Reader", "", CNSTypeInt32, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &readerEndpointID); |
If you configure the endpoints in this manner, the writer endpoint establishes a connection with the reader endpoint. Therefore, you can change the writer endpoint that connects to the reader endpoint. |
// Passive endpoint CNSNewScalarEndpoint ("Writer", "", CNSTypeInt32, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &writerEndpointID); |
CNSNewScalarEndpoint ("Reader", "//10.0.38.56/Writer", CNSTypeInt32, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &readerEndpointID); | If you configure the endpoints in this manner, the reader endpoint establishes a connection with the writer endpoint. Therefore, you can change the reader endpoint that connects to the writer endpoint. |
CNSNewScalarEndpoint ("Writer", "//10.0.0.62/Reader", CNSTypeInt32, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &writerEndpointID); | CNSNewScalarEndpoint ("Reader", "//10.0.38.56/Writer", CNSTypeInt32, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &readerEndpointID); | If you configure the endpoints in this manner, both endpoints are active. |