Lachlan Gunn wrote:

Hi,
Is there a way in which I can spawn a thread in a cross-platform way?
I'm making a ranking system, and would rather not force the client to
wait for a response from the server or a timeout before changing maps.

Also, what would be the best way to use HTTP from the mod?  Is it
possible to do this without #ifdef'ing code for Windows and Linux?
--
Thanks,
Lachlan


I recommend finding a library that does what you want. I think apr from
the Apache project at http://apr.apache.org does everything you're
talking about. From the apr website:

"The mission of the Apache Portable Runtime (APR) project is to create
and maintain software libraries that provide a predictable and
consistent interface to underlying platform-specific implementations.
The primary goal is to provide an API to which software developers may
code and be assured of predictable if not identical behaviour regardless
of the platform on which their software is built, relieving them of the
need to code special-case conditions to work around or take advantage of
platform-specific deficiencies or features."

As you can see from the documentation
http://apr.apache.org/docs/apr/modules.html it seems to handle threads
and networking, which is what you need to do the two things listed
above. Querying an HTTP server is as simple as opening port 80 on that
machine and writing the HTTP headers, then reading and parsing the
response. If you don't know what the HTTP headers are, read the HTTP RFC
specification!

--
Jorge "Vino" Rodriguez


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to