In a saucepan, stir together sugar, cocoa, cornstarch and salt.
Place over medium heat, and stir in milk. Bring to a boil, and cook, stirring constantly, until mixture thickens enough to coat the back of a metal spoon.
Remove from heat, and stir in butter and vanilla.
Let cool briefly, and serve warm, or chill in refrigerator until serving.