It seems you are trying to connect to a webserver. If you are, then keep reading, else, don't.
Since you are connecting to a web server (right?) You won't get any data if you don't send a request first. Read about the http protocol to know how to send such request.
A typical http request looks like this:
GET / HTTP/1.1
Host: www.google.com.mx
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PREF=ID=19d98d8c54ef559b:LD=es:TM=1105414679:LM=1105414681:S=D9KNrJvB4oE-egS9
What you really need is the first two lines. Most web servers respond to a request like
GET / HTTP/1.1 Host: www.google.com.mx
An http request should contain two crlf chars (double \r\n) at the end.
Host is very important if the website is shared-hosted. The / in the first line means the resource you are trying to get. You should know exactly what you want (that depends on the server configuration) or the server will respond you with an error or a redirection code (ie., if you request / the server might respond you with a redirection code to /index.html instead of the actual index page).
store the request into a buffer and send it with NetLibSend.
And you need to discard the http header to get only the document the server is sending (the server responds with a header telling some useful stuff to the browser).
It is easier than it looks like, but you have to know a little about the http protocol. Google "http protocol" to get some useful resources and/or use a network protocol analizer, such as ethereal while you request a web page to learn more on how to make your request.
Hope this helps Miguel
versha khar wrote:
first error - If i give my domain name as www.xyz.com in NetLibGetHostByName , i get Palmsim.exe error . But if i give as http://www.xyz.com it doesnt? which is the correct way?
second problem i have in my prog attached below do i need to call NetLibsend ..if i just want to store data what i get from the website.should i use only NetLibReceive ?
third problem is in NetLibReceive ..where i get 0 bytes received.
i cant figure out my problem...i am new to network programming.
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
