--Network Music Player Daemon alpha by Hexxeh--What port do we listen for requests on? Default is fine, don't change unless you've got a good reasonPORT = 2222-----------------------------------------DON'T EDIT BELOW HERE!---------------------------------------require("socket")print("Network Music Player Daemon Started")nmpd = socket.tcp()nmpd:bind("*", PORT)nmpd:listen()recvt = {}connections = 0;table.insert(recvt,nmpd)function PlaySong() print("NMPD: PlaySong not yet implemented")endfunction StopSong() print("NMPD: StopSong not yet implemented")endfunction PauseSong() print("NMPD: PauseSong not yet implemented")endwhile true do local reading,writing,err = socket.select(recvt,nil) if reading[nmpd] then local connected = nmpd:accept() table.insert(recvt,connected) connected:send("HELLO\n") connections = connections + 1 print("NMPD: New client connected. Total: ".. connections ..".") else for k,v in pairs(reading) do local message,err = v:receive("*l") if err == nil then if message == "BYE\n" then connections = connections - 1 connected:close(); elseif string.sub(message,1,4) == "PLAY" then PlaySong() elseif string.sub(message,1,4) == "STOP" then StopSong() elseif string.sub(message,1,5) == "PAUSE" then PauseSong() end end end endend