The following ruby snippet (adapter from an example in 'Programming Ruby') does just that:
port = ARGV || 80
server = TCPServer.new('localhost', port )
while( session = server.accept)
Probably cooler would be if it took everything on
STDINand echo-ed it back to the socket as well.
Update: Thanks pooja. I couldn't think of netcat at the time but that does exactly what I want. I'm such an idiot for not remembering.