to be honest I don't really know. I found this code in the internet and checked that it worked for me with both wifi and gprs. I will look  closer on it now.