Hi,
First u find out the machine where the gateway is running has got internet connection, then check out on which port the gateway is running,now in ur client programme set the port number and machine IP of the gateway.I hope it will work fine.......
cheers
Deepak