![]() |
Web Client
im trying to extract information from a website..
Ive tested my client on my university's email login page IP is :
"193.188.129.122":
Connection: close\r\n:
while(flag == true):
Communication With Server on Socket 1992 Initiated |
You are opening a persistent connection.
:
Connection: Keep-AliveThis is most likely due to HTTP/1.1; try using HTTP/1.0. |
Look at this page for using recv, should help:
http://www.opengroup.org/onlinepubs/...ions/recv.html Realize that recv returns a value. That value is how many bytes were read. So read until it stops receiving bytes. Remember, it returns negative if there was an error, so handle that too. This operation will block- which means, it will hang your application. This is not so great if your application wants to do other stuff while waiting for this data. To solve, you should put this into a seperate thread (unless your app doesn't do anything until it gets the data- in which case its ok BUT if this is GUI app, use thread or GUI will hang). Also, you shouldn't put the declaration of your pointer inside the loop. Also, you should consider not new/delete over and over in the loop. Instead, write to a buffer and reallocate the size as needed. There is a function called realloc that can help. -- |
Quote:
|
| All times are GMT -5. The time now is 1:02 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC