?
Solved

CBuilder & TNMHTTP Component

Posted on 1998-05-26
5
Medium Priority
?
584 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
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…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

801 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