Solved

CBuilder & TNMHTTP Component

Posted on 1998-05-26
5
571 Views
Last Modified: 2012-05-04
Borland CBuilder3 comes with an HTTP component by NetMasters. It works fine when I want to 'GET' a text file.
& by changing the InputFileMode between TRUE & FALSE, I have no problem in GETting the text file either as a saved file or as an Ansi-String. My problem start when I want to GET an image, ie: BMP,GIF or JPG. The SendHeader request appears OK for binary images, (TNMHTTP->SendHeader->Text;), however depending on InputFileMode I either GET an empty file or an Error Message stating that GET failed. I'm at a loss to guess what else to try.
Thanks Hugh.
0
Comment
Question by:Matlock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:JensUniweb
ID: 1164720
I don't want to dissapoint you, but when I look at the nmhttp.hpp I see that it uses AnsiStrings everywhere. So it may be that this component can not handle binary data. I'll check this later today.
0
 

Author Comment

by:Matlock
ID: 1164721
The AnsiStrings in the .hpp file are all to do with names of locations and files / commands. So I don't believe that this actually relates to how binary data is handled. Hugh
0
 
LVL 2

Expert Comment

by:JensUniweb
ID: 1164722
The body and header of the returned data is put in the header and body varbles. And they are AnsiStrings. I have not had time to investigate if there is away to receive binary data anyway.
0
 
LVL 2

Accepted Solution

by:
JensUniweb earned 100 total points
ID: 1164723
I've tried this some more now. I don't get InputFileType = true to work as I expect it to do after reading the documentation. But when you use InputFileType = false you can save the data to file or copy it to memory by using Body.c_str() and BytesTotal. I saved it to file with these two rows.

    ofstream tX( "x.x",ios_base::binary|ios_base::out );
    tX.write( NMHTTP1->Body.c_str(),NMHTTP1->BytesTotal );

NMHTTP1 is the HTTP component. This way I could get pictures and other binary data.

But anyway I think this component does not work as it should one way could be to contact Inprise(Borland). But I think that they will ask you to talk with NetMaster L.L.C. And to get support from them you may have to buy it. I don't know this yet because I've not tried it yet.
0
 

Author Comment

by:Matlock
ID: 1164724
HI! That's great, I'm sure you're right that it doesn't work correctly but anyway thanks for pointing me in the RIGHT direction I can now at least GET binary data Thanks
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question