Thanks, I cannot get it to run with my vncviewer (TightVNC Viewer
version 1.3.9)

How should I call vncviewer and your Main binary?

./Main 200 200 5900

after this, the program should start listening to port 5900

You can check if things are fine by telneting to localhost:5900, you should see this - 

ck@ck-desktop:~/lab/Chitra$ telnet localhost 5900
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
RFB 003.003

After this, you can use vncviewer to connect to localhost (5900 is the default port for vnc)
 

P.S. after getArgs in Main.hs use
 case args of
   [x, y, p] -> ...
   _ -> putStrLn "usage: Main xres yres port"

 instead of "!!"

Thanks Christian ... I've incorporated this.

Regards,
Kashyap