<p>I have a server that sends data via a socket, the data is a wav 'file'. I can easily write the data to disk and then play it in WMP, but I have no idea how I can play it as I read it from the socket. Is it possible?</p>

<p>Bonus question: how would I do it if the stream was in mp3 or other format?</p>

<p>This is for windows in native C++.</p>

Because you've said WMP, I'm assuming the question applies to trying to play a wav file on a windows machine.  If not, this answer isn't relevant.
What you want to do isn't trivial.  There is a good article
here
on code project that describes the windows audio model.  It describes how to set up the audio device and how to stream data into the device for playback.  You "simply" need to supply data coming in from your socket as data for the playback buffers.  But that's where all of the tricky work is.  You have to be sure that
You have enough data to begin a playback
Handle the case when your socket is starved for data and you have nothing to send to the playback buffer
You are able to read data off of the socket with enough speed to keep the playback buffers full
It's an interesting exercise.  But tricky.