Solved

CBuilder & TNMHTTP Component

Posted on 1998-05-26
5
557 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now