You want to use the builtin WWW class to fetch stuff from a HTTP server.
In this case, you MUST have a crossdomain.xml file that is hosted by that SAME HTTP server,
This will allow, and ONLY allow Unity's builtin WWW class to work. It has no effect on the usage of .NET sockets within Unity.
This particular setup will NEVER help you get .NET sockets (and by
extension UniWeb) working within Unity WebPlayer.
You want to use UniWeb to fetch stuff from a HTTP server.
In this case, you MUST have a server process running on a port on the SAME host, which follows the behaviour specified in the manual.
This will allow .NET sockets (and therefore UniWeb) to work within a Unity WebPlayer. The Security.PrefetchSocketPolicy MUST be called before .NET sockets will successfully connect to a host on ANY port.
Particularly note this section from the manual:
Specifically the server expects to receive a zero-terminated string
. It only sends to the client the socket policy xml document when this string (and exactly this string) has been received. Further, it is required that the xml header and xml body are sent with a single socket write.
Note: Whilst the crossdomain.xml and socket policy files are both xml
documents and are broadly similar, the way that these documents are served are very different. Crossdomain.xml (which applied to http requests) is fetched using http on port 80, where-as the socket policy is fetched from port 843 using a trivial server that implements the <policy-file-request/>. You cannot use an http server to issue the socket policy file, nor set up a server that simply sends the socket policy file in response to a socket connection on port 843. Note also that each server you connect to requires its own socket policy server.