• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading a file from URL

 
vin Hari
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
i am going through one application, the main task is to read a file from url
for example

iam using unix environment iam setting this path to one environment variable. through which iam reading port as :80, protocol as:http
and iam opening url connection through some function and through which iam reading filedescriptor iam getting some number(non zero) which iam giving for ifstream and reading through rdbuf(),but this is not executing,
so please can you tell what are the necessary steps that are required in order to read a file from url. aim using socket programming for this.
 
Joe Ess
Bartender
Posts: 9295
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be a good idea to Tell the Details. It does not sound like you are using Java for this task. What language are you using? Can you share some code?
 
vin Hari
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello thank you,
for reply yes it i correct that iam using unix with c++,but i thought of asking the suggestions as you people give good suggestion,
my question is iam using http protocol to connect, though which iam sending server name

so my question is when i type this URL with file that particular file should get opened ,sorry that i cant send the code because it is very huge,
so please tell how it can be done iam usng socket programming for this.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked into curl with its c++ bindings? It seems like it would be a lot easier to use an established library like that than to do the socket programming yourself.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the url work, if you put it into a browser?

I don't know how to open remote files with c++, but if this isn't a webserver, but a fileserver, you're using the wrong way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic