i have to write c program in which the file can be transfer to server , we have the http url link for that.what we have to do for sending and receiving file/data. Actually i have to send file to http server , on calling url the file will be transfer.it's like that when user click on send the text file will transfer to that server. help so some light ..any link that i can get help .thanking you
-
This might be worth having a look at: chilkatsoft.com/refdoc/c_CkHttpRequestRef.htmlcamden_kid– camden_kid2012-03-05 09:48:09 +00:00Commented Mar 5, 2012 at 9:48
-
thanks for your support.. i have written simple client server program in vs2008 using winsock.h with the help of tenouk.com/Winsock/Winsock2example2.html and it's work fine.but the problem is that i have to generate a http url for server on which the client open that and send the data to server. i can't understand how client communicate with http url and how the data received by server just by opening that url by client.user1196792– user11967922012-03-05 10:06:18 +00:00Commented Mar 5, 2012 at 10:06
Add a comment
|
1 Answer
From reading the comments, it sounds like you're going in the direction of using sockets directly. Don't do that. Use an HTTP client library. The basic HTTP protocol is simple enough that the sockets approach is workable for a rudimentary client, but you won't support features like HTTP keepalives, proxy servers, encryption (https), HTTP/1.1, compression, chunked encoding, or 100 continue without completely reinventing the wheel.
Use libcURL. When writing in C, uploading a file to an HTTP server is only a few dozen lines of code, including boilerplate.
5 Comments
user1196792
thank you.yes you are write i have to use basic http protocol for that .but i don't want to use libcUrl lib. for that , i just want to send xml/text file to http server.Did i get any step by step tutorials for that .i don't know what to use GET or POST and how to use it . help plz
user1196792
actually before this issue i send the user,pwd from client to http server for verification in which i generate the query string(containing usr,pwd) and send req. to server which work .But now i have to send file(text/xml) to that server.what the working of server in this case .
Celada
If you want to send a file, read up on the PUT method. In its simplest form you can just send the method, the headers, a blank line, then the contents of the file, then close the socket. But libcurl will do all of this and more for you and it will be a lot less work and more compatible. You didn't explain your objection to using libcurl or another HTTP client library.
user1196792
ya we can use libcurl for sending file to server but how http server received it there end.what we do for receiving from server .i m using vs2008.window xp ,client side written in c .
Celada
You didn't ask about a server, you asked about a client. How you accept the file on the other end is a separate question and depends what you want the server to do with the file and what web server you are using.