tbob's solution will work if the AT commands create a "real" network connection in your PC (one that appears with your other network connections).
If they do, then you may need to wait before opening the TCP connection.
If they don't, then you will probably need to continue doing this through AT commands to your GPRS modem, and you would need to know the proper AT commands for opening, sending, receiving and closing a TCP connection.
___________________
Try to take over the world!