Solved

CBuilder & TNMHTTP Component

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Building cUrl in Windows v7.43.0 4 28
Converting to C# also VS2015 5 117
Socket Programming (Unix) 8 118
passing data from one form to another form in c++ 27 75
  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 …
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 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

11 Experts available now in Live!

Get 1:1 Help Now