Solved

http library for solaris 2.5

Posted on 2001-07-03
3
278 Views
Last Modified: 2013-12-27
I am looking for a class library which would eliminate the need to write HTTP at the socket level.

It should be clean enough so that I could do something simple like this example where I establish a connection to a HTTP server, do a HTTP-POST and disconnect.

ClassHTTPStream httpStream;
ClassHTTP httpObj;

try
{
  httpStream = "val=hello world";
  httpObj.connect("4.3.2.1", Port);
  httpObj.Post(httpStream);
  httpObj.disconnect();
}
catch(ClassException E)
{
  // handle http error here
}
0
Comment
Question by:PinTail
[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 Comments
 
LVL 1

Expert Comment

by:shanechambers
ID: 6251240
Does it have to be in C++?  If not, Perl has lots of libaries for doing things like this.
0
 
LVL 3

Author Comment

by:PinTail
ID: 6251751
C++ is a requirement.

This is a server side application communicating with another server side app via an HTTP server.

It sounds kind of dumb to me, but that's what I have been told to do.

I wrote a HTTP Server about 5 years ago, but since then have had NOTHING to do with HTTP, and really don't want to be bothered to write my own library to do this kind of grunt work, I really just want to ship this data via HTTP in the simplest possible way.
0
 
LVL 3

Accepted Solution

by:
graf27 earned 300 total points
ID: 6334362
And you can't use Java for the Post-Request ?


import java.net.*;
import java.io.*;

public class MyClass  {

public static void main(String args[]) throws Exception
{


  URL target = new URL("http://servername.com/cgi-bin/serverprogram");
  HttpURLConnection conn =    (HttpURLConnection)target.openConnection();

     conn.setRequestMethod("POST");
     conn.setRequestProperty("Content-type","text/html");
     conn.setDoOutput(true);
     conn.setDoInput(true);
     conn.connect();

     PrintWriter xout = new PrintWriter(conn.getOutputStream());
       xout.println("what you want to post");

     InputStream xin = conn.getInputStream();
    -- Do anything with the response
}

}


On Solaris, you don't need C++ compiler. Just use:

javac  MyClass.java
java MyClass

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

617 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