I want to create a new EndpointPair object:
// hostname is a string
// port is an integer
var endpointPair = new Windows.Networking.EndpointPair(null, null, hostname, port);
But I always get this error:
0x800a000d – JavaScript runtime error: Type mismatch
I’ve already tried the following:
- converting port to a string
- passing “” instead of null for the first two Parameters. (null should be okay if the documentation here, under the section Remarks, is right)
- passing no Parameters, but that ends up in an “too few parameters” error message
Above all, the documentation about the constructor has been removed (as of September 4, 2012): http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.endpointpair.endpointpair.aspx
It looks like the documentation is completely wrong. The constructor is actually:
So you can use it as such:
You can see this when you look at the metadata for the remoteHost property is typed as
Windows.Networking.HostName