PC-Link Protocol

PC-Link Client: Streamium
PC-Link Server: PC

Here's an example pc-link client sever interaction (note that the html headers have been omitted):

1) Client sends the following UDP broadcast on port 42591:

<PCLinkClient>
  <Version>1.0</Version>
  <Name>MC-i200</Name>
  <VendorID>Philips</VendorID>
  <IP>1694607552</IP>
  <Port>51111</Port>
</PCLinkClient>




<- IP address and port of client
<- in little endian format
   (in this example IP:192.168.1.101 Port:42951)

2) Server responds by making a TCP connection to the client on port 42951 (not 42591):

<PCLinkServer>
  <Version>1.0</Version>
  <VendorID>MUSICMATCH</VendorID>
  <name>Nathan's MP3s</name>
  <ShortName>Nathan's MP3s</ShortName>
  <IP>1677830336</IP>
  <Port>51111</Port>
</PCLinkServer>





<- IP address and port of server
<- in little endian format
   (in this example IP:192.168.1.100 Port:42951)

3) TCP connection is closed and the client makes a TCP connection to the server on port 42951 and sends a requestnavdata tag:

<requestnavdata>
  <reqparameters>
    <fpsv>30</fpsv>
    <iamsv>101</iamsv>
    <nc12>313911855841</nc12>
    <setnc12>907310010777</setnc12>
    <uid>0</uid>
  </reqparameters>
  <serviceid>1</serviceid>
  <numelem>32</numelem>
</requestnavdata>
I don't know what most of these xml tags are,
but the only ones that seem to be important
for my purposes are <nodeid> and <numelem>.
Since <nodeid> is not included here it is
assumed to be a request for node 0.




<- maximum number of nodes to send

4) Server responds by sending the contents of node 0:

<contentdataset>
  <contentdata>
    <name>Artist</name>
    <nodeid>1</nodeid>
    <branch/>
  </contentdata>
  <contentdata>
    <name>Album</name>
    <nodeid>2</nodeid>
    <branch/>
  </contentdata>
  <contentdata>
    <name>Genre</name>
    <nodeid>3</nodeid>
    <branch/>
  </contentdata>
  <contentdata>
    <name>Playlist</name>
    <nodeid>4</nodeid>
    <branch/>
  </contentdata>
  <contentdata>
    <name>Track</name>
    <nodeid>5</nodeid>
    <branch/>
  </contentdata>
  <totnumelem>5</totnumelem>
  <fromindex>0</fromindex>
  <numelem>5</numelem>
</contentdataset>
Node 0 is the top node and in this case contains
links to nodes 1 through 5.  This is where you
Select how to browse your mp3s (by Artist, Album,
Genre, Playlist, or Track)

Maximum number of nodes we should send at a time
(see previous) is 32.  Since there are only 5
nodes total linked to node 0 we can send them
all at once and totnumelem = numelem.

















<- total number of nodes to be sent
<- offset from beginning of node list
<- number of nodes sent with this response 

5) Client requests the contents of node 1:

<requestnavdata>
  <reqparameters>
    <fpsv>30</fpsv>
    <iamsv>101</iamsv>
    <nc12>313911855841</nc12>
    <setnc12>907310010777</setnc12>
    <uid>0</uid>
  </reqparameters>
  <nodeid>1</nodeid>
  <serviceid>1</serviceid>
  <numelem>32</numelem>
</requestnavdata>








<- request node 1 (browse by artist)

6) Server responds with the first 32 elements of node 1:

<contentdataset>
  <contentdata>
    <name>Ben Folds Five</name>
    <nodeid>286</nodeid>
    <branch/>
  </contentdata>
  ...
  <contentdata>
    <name>Mick Karn</name>
    <nodeid>201</nodeid>
    <branch/>
  </contentdata>
  <totnumelem>57</totnumelem>
  <fromindex>0</fromindex>
  <numelem>32</numelem>
  <alphanumeric/>
</contentdataset>






<- 30 nodes omitted to make this more readable





<- 57 nodes total (57 different artists in this collection)

<- only the first 32 are sent this time

7) Client requests the rest of the contents of node 1:

<requestnavdata>
  <reqparameters>
    <fpsv>30</fpsv>
    <iamsv>101</iamsv>
    <nc12>313911855841</nc12>
    <setnc12>907310010777</setnc12>
    <uid>0</uid>
  </reqparameters>
  <nodeid>1</nodeid>
  <serviceid>1</serviceid>
  <fromindex>32</fromindex>
  <numelem>32</numelem>
</requestnavdata>
Here the <fromindex> tag is added
to tell the server where it left
off last





<- request node 1

<- but start list from the 32nd element

8) Server responds with the rest of the elements in node 1: 

<contentdataset>
  <contentdata>
    <name>Monty Python</name>
    <nodeid>22</nodeid>
    <branch/>
  </contentdata>
  ...
  <contentdata>
    <name>Yoshihiro Hanno meets Mick Karn</name>
    <nodeid>221</nodeid>
    <branch/>
  </contentdata>
  <totnumelem>57</totnumelem>
  <fromindex>32</fromindex>
  <numelem>25</numelem>
  <alphanumeric/>
</contentdataset>






<- 23 nodes omitted
to make this more readable






<-
<- 25 elements listed starting from the 32nd element

9) Client requests contents of node 286 (artist Ben Folds Five):

<requestnavdata>
  <reqparameters>
    <fpsv>30</fpsv>
    <iamsv>101</iamsv>
    <nc12>313911855841</nc12>
    <setnc12>907310010777</setnc12>
    <uid>0</uid>
  </reqparameters>
  <nodeid>286</nodeid>
  <serviceid>1</serviceid>
  <numelem>32</numelem>
</requestnavdata>








<- request node 286

10) Sever responds with contents of node 286 which in this case happens to be only one node and it is a playable node (it is the song "Brick"):

<contentdataset>
  <contentdata>
    <name>Brick (Dance Remix)</name>
    <nodeid>285</nodeid>
    <playable/>


The url here points back to the pc-link server with
a path to the actual file.
    <url>http://192.168.1.100:42951/F%3A%2FMy%20Music%2FBlueDisk%20Kazaa%2F(Ben_Folds_Five)_Brick_(Dance_Remix).mp3</url>
    <title>Brick (Dance Remix)</title>
    <album></album>
    <trackno></trackno>
    <artist>Ben Folds Five</artist>
    <genre>Booty Bass</genre>
    <year></year>
    <bitrate>128000</bitrate>
    <playlength>232</playlength>
  </contentdata>
  <totnumelem>1</totnumelem>
  <fromindex>0</fromindex>
  <numelem>1</numelem>
  <alphanumeric/>
</contentdataset>

This url could really point anywhere though.
It could point to a mp3 stream on the internet,
or it could point to a mp3 file on a webserver
or mp3 server hosted on your PC.  The pc-link
server has to be able to mp3 server as well if
you want to point this url to it.  My pclink.pl
script doesn't do this, so if you want to serve mp3s
you'll have to install apache or some other web or mp3 server.

Note that the bitrate and playlength can be omitted.
The streamium uses the playlength to produce a percent
complete bar, but if omitted it will just show the time played.
(bitrate is in bits, playlength is in seconds)

At this point the pc-link client has the url for the ben folds five song and can connect to the server specified by the url and request the mp3 with a http get command.

That's all folks!