Advertisement

HTTP Protocol :: Winsock

Started by June 20, 2002 02:57 PM
9 comments, last by kuphryn 22 years, 7 months ago
Hi. I posted a thread about adding a feature to a program that searches a websites via Google. I have the basic design and implementaton done. Now I am debugging it. I have successfully design and implement a chat program using TCP/IP and non-blocking mode via WAsynSelect(). I am using that same design with this website algorithm. I am running into a problem in this early debugging stage. The program is I am not sure if TCP/IP and HTTP are the same or are similar. With TCP/IP and using WAsynSelect() mode, the non-blocking model relies on the Windows messaging system. With HTTP protocol, will the server, i.e. Google, send messages about the read, write, and/or close status of a socket (the socket connects the user computer to Google server via an Internet). Thanks, Kuphryn
TCP is like the telephone. HTTP is like a language. You speak HTTP using TCP. HTTP is not a replacement for TCP or something like that.

Read these to get the full details about HTTP:
http://www.ietf.org/rfc/rfc1945.txt?number=1945
http://www.ietf.org/rfc/rfc2068.txt?number=2068
-Mike
Advertisement
Thanks.

From some of the responses I have seen, I am getting a messages that in this program, I will have to do three things over and over again.

- connection to search engine
- send search
- receive response
- disconnection from search engine

The problem is when should you *receive*? For example, let say you send a message to search for something. When do you know the server is sending data base? With the chat program I am working on, TCP/IP sends some type of notice and then Windows messages a message to WAsynSelect(). That is who I know when to receive data. Moreover, the same works for sending data. Everything works in along with Window messaging system.

So do I need to *assume* the server will send a response immediately after I send a search message? My concern is when to call send, receive, and disconnect. With the chat program I have control over everything because the chat program is both a server and a client.

Kuphryn
Google Web APIs. Those folks at Google are incredible, aren''t they?
I have looked at using Google API. I do not like the fact that under a license, you can only do 1,000 search a day. I will distribute the program, so I need something that is unlimited.

Kuphryn
If you''re going to distibute the program then you need to ask Google for permission to use their search facilities and also pay them a license fee.
Or you can write the program using HTTP requests which is the easiest thing to do but is going to be unreliable if Google decide to change their URL for performing a search.
Martin Piper
Advertisement
I will update the program whenever Google decides to change their search commands.

Kuphryn
I will update the program whenever Google decides to change their search commands.

Kuphryn
first off, even using the url facilitae for searching is service abuse hence you still need a liscence. you cant advertise you have google search support since google is not giving you permission to use their service in this manner.

you dont seem to understand, TCP/IP is nothing more then a method of communication. it works EXACTLY the same when used in yoru chat program, web browser, irc chat, ftp, video streaming, etc. the only thing that changes is the actual data you send/recv.

you have any control when to dictate when something should be revc''d from a server. the server decides this. even if the chat app is both a server and client (ie you probably went and did peer to peer), the guy at the other end dont care when you want the data. it sends the data when its ready to send.

normal http protocal:
client connects
server accepts (may take some time depending on load)
client sends GET request
server replies with resource (may take some time depending on server load, processing required for resource request, etc. its quite possible the server returns an error code instead)

the tricky part one of the following occers next:
server disconnects you
client makes more requests (ie does the entire thing above again with the exception of connect isnce the client is already connected) then client disconnects.

it depends on the server config and how you setup your GET request. ussually the server discconects you after sending all the data associated with the requested resource (in this case a single html page). images on the page are seperate requests.

if this still dont make sense, read the http protocal rfc AND do research on TCP/IP and winsock. you will need to learn how to use winsocks before writing this app (it is clear you did not write or understand the code used when creating the chat app).

there is no assumptions need to be made. just follow what the protocal dictates, the server does as do most web browsers. if the protcal says wait for a message from the server, you wait for the message. its that simple.
Hmmm

You make a valid point about licensing. So it is okay to use Internet Explore to do a search on a search engine like Google because Microsoft has a licensing agreement with Google?

The program is almost ready for a beta test.

Kuphryn

This topic is closed to new replies.

Advertisement