How do u write a server to open or close ports ???

and then use a client to access the server????

if the code is short plz post it on this forum