connection to server via HTTP & GET/POST method in vc++

R

rup

Hello,
This is my first application on socket programming in vc++. I am facing
problem that how to make connection to server, & make GET/POST request
by HTTP.
Please help me. Its urgent....
Thanks
 
S

santosh

rup said:
Hello,
This is my first application on socket programming in vc++. I am facing
problem that how to make connection to server, & make GET/POST request
by HTTP.
Please help me. Its urgent....
Thanks

Since this is a Microsoft specific question, try posting to
comp.os.ms-windows.programming or one of the microsoft.* groups. Also
see the MSDN documentation.
 
R

Richard Heathfield

santosh said:
Since this is a Microsoft specific question,

The fact that he's using VC++ is less significant, I think, than the fact
that he's trying to learn how to do network programming. His best bet is to
learn about sockets from "Unix Network Programming", with the minor tweaks
needed for getting it to work under Windows being a valuable part of the
learning experience. Then he can learn about HTTP from the relevant RFC.
try posting to
comp.os.ms-windows.programming

I've never heard of that group, and I suspect it doesn't exist. You probably
mean comp.os.ms-windows.programmer.win32

<snip>
 
B

Bill Reid

Richard Heathfield said:
santosh said:

The fact that he's using VC++ is less significant, I think, than the fact
that he's trying to learn how to do network programming. His best bet is to
learn about sockets from "Unix Network Programming", with the minor tweaks
needed for getting it to work under Windows being a valuable part of the
learning experience.

Don't think so, dude...

Just because he THINKS his problem has to do with "socket
programming", what he specifically said he wanted to do was
"make a connection to a server, & GET/POST request by
HTTP".

This again is the old idea of somebody asking "how do I drive
to Chicago?", you tell them to learn how to cast an engine block...
Then he can learn about HTTP from the relevant RFC.
This will be a definite help, but here's the actual answer:

1. Go to the MSDN web-site, specifically you should try:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us
/wininet/wininet/portal.asp
2. Download the "wininet" API (or other equivalent Microsoft
Internet client-server API) for absolutely friggin' free
3. Use it as directed in the documentation (a knowledge of
HTTP is somewhat helpful here when trying to puzzle out
Microsoft's particular API implementation of Internet protocols)

The important thing is if he just wants to write an application that
GETs/POSTs information on the "Internet", that he not waste time
re-inventing the metallurgy of "sockets" and the HTTP protocols,
since it has already been done for him.

The other important warning I must give him is
to be very wary of the many "open source" goofball HTTP
non-implementations that infest the nooks and crannies of
the Internet, crap that doesn't work, crap that never will
work, half-written crap written by retards with idiotic non-documentation
that ultimately just says, "We're a bunch of retards who have
no idea how to implement Internet protocols but in the generous
spirit of 'open source' we'll let you waste your time trying to use
something that doesn't work."

I can personally vouch that the Microsoft stuff, once you puzzle
out how to use it, works, and works flawlessly...

And I should probably point out, in the spirit of "topicness",
that "wininet" and other Microsoft Internet APIs actually are
C++, and MUST be compiled by a C++ compiler...
 
R

Richard Heathfield

Bill Reid said:
Don't think so, dude...

Just because he THINKS his problem has to do with "socket
programming", what he specifically said he wanted to do was
"make a connection to a server, & GET/POST request by
HTTP".

He also made it very clear that he wants to write a sockets-based program.
This again is the old idea of somebody asking "how do I drive
to Chicago?", you tell them to learn how to cast an engine block...

No, it isn't, and you have made that mistake more than once. It's more like
teaching them how to drive (program sockets) and then giving them a route
map (the HTTP RFC).
 
B

Bill Reid

Richard Heathfield said:
Bill Reid said:

He also made it very clear that he wants to write a sockets-based program.
Anything you do with a network on a Unix or Windows box
is going to involve "sockets"! (Unless you choose to reinvent
THAT wheel too!) That doesn't mean you have to actually
deal with "sockets", any more than you have to deal with any
particular network card driver that will also be involved "under
the hood" when you write a networking application!

If this is a class exercise (which of course, it may very well
be), then his "urgent" request is gonna take at least a little while
to resolve, because as you note he first has to learn the general
concepts of "sockets", then he has to implement a specific
library (in this case, "winsock"), then he has to learn the HTTP
protocol, then he has to implement the whole friggin' HTTP protocol
from the ground up using his "sockets" library!

Considering there are goofballs out there who clearly haven't
been able to figure out how to do this as a "community effort"
for the better part of a decade, that's a hell of an "urgent" homework
assignment!
No, it isn't,

You don't KNOW that. A lot of people get confused when trying
to write an application that gets (or "posts") stuff using HTTP, they
mistakenly think that they DO have to implement it "from the ground
up" starting with the "sockets" library (I myself thought that for
several years, because it WAS true for several years)...if that's the
case, I'm just giving him the quickest ("urgent") way to solve the
problem...just tryin' to be helpful, is all...
and you have made that mistake more than once. It's more like
teaching them how to drive (program sockets) and then giving them a route
map (the HTTP RFC).
My analogy was apt, yours is a little more conceptually inept...teaching
somebody to "program sockets" is more like teaching somebody the
general concepts of assembly line manufacturing, then handing them a
set of "blueprints" (HTTP) for a car you want them to manufacture...but
it could have been a jet plane, or a train locomotive, or a golf cart...

Let me try to clear it up for you. His question is actually equivalent to:

"Hello,
This is my first application on I/O programming in C. I am
facing problem how to make connection to terminal,
& get words from user keyboard and send words to user screen.
Please help me. Its urgent...."

Now tell me: how you would answer THAT question?
 
B

Bill Reid

Richard Heathfield said:
Bill Reid said:



Please don't bother. When I need to know how not to teach, I'll give you a
call.
OK. We'll miss you around here, but I can understand your
decision to leave. Again, the question you not only couldn't answer,
but were so confounded by you felt you had to snip it, was:
"Hello,
This is my first application on I/O programming in C. I am
facing problem how to make connection to terminal,
& get words from user keyboard and send words to user screen.
Please help me. Its urgent...."

I guess when you can't even answer a question about the
"C" standard libraries it's time to "sail off into the sunset"...
 
R

Richard Heathfield

Bill Reid said:

Again, the question you not only couldn't answer,
but were so confounded by you felt you had to snip it, was:

It is a mistake to confuse "didn't" with "couldn't".

<snip>
 
C

CBFalconer

jacob said:
rup a écrit :

If you use the lcc-win32 compiler, you write:

int return_code =
GetHttpUrl("http://www.mysite.com/something.txt","c:\\temp\\downloads");

http://www/cs/virginia.edu/~lcc-win32

This will not work using VC++

And it won't work on anything else either, and thus is OFF-TOPIC on
c.l.c. Why don't you create a sig that redirects queries to
comp.compilers.lcc where it would be topical. Then you might be
able to avoid these persistent irritating off-topic answers.

The only way you could make it topical here would be to publish the
complete code, written in standard C, in your answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top