Home Help Center

Invalid argument socket error on HP-UX

tctimmehtctimmeh Member Tim CourtOrganization: Enbridge PipelinesProject: Historical Data Retriever
I'm getting an unexpected error when trying to connect a client proxy to localhost on HP-UX in C++. The error I'm getting is:
Network.cpp:1661: Ice::SocketException:
socket exception: Invalid argument

my sample app:
#include "iostream"
#include "Ice/Ice.h"
using namespace std;
using namespace Ice;

int main(int argc, char** argv) {
  try {
    CommunicatorPtr ic = initialize(argc, argv);
    ObjectPrx prx = ic->stringToProxy("something: tcp -p 21378 -h localhost");

    try {
      LocatorPrx loc = LocatorPrx::checkedCast(prx);
    } catch(ConnectionRefusedException& e) {
      cout << "all good" << endl;
    }
  }
  catch (exception& e) {
    cout << "except: " << e.what()  << endl;
  }

  return 0;
}

and my make command:
/opt/aCC/bin/aCC -AA +DAportable -mt -D_HPUX_SOURCE -I/usr/local/opt/Ice-3.3.0/include -L/usr/local/opt/Ice-3.3.0/lib asdf.cpp -lIce -o asdf

I've found that this error only occurs when these two conditions are met:
  • Connecting to localhost in any way (supplying no -h, using 127.0.0.1, etc)
  • The server is not running

I'm wondering if I'm doing something wrong or if this is expected behaviour on HP-UX and I just need to handle it.

Any thoughts?

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    That is definitely not expected behavior. We tested HP-UX 11.11 (PA-RISC) with HP aCC 3.56, 32/64 bit (as outlined on http://www.zeroc.com/platforms.html) extensively during the Ice 3.3 release process, and did not encounter any failure.

    What version of HP-UX and aCC are you using? Did you try any of the demos? Are they working? If the demos are working, and your application is not, then perhaps they can help you pinpoint the source of your problems (for example, perhaps your compiler and/or linker flags are incorrect).
  • tctimmehtctimmeh Member Tim CourtOrganization: Enbridge PipelinesProject: Historical Data Retriever
    HP-UX version is:
    $ uname -s -r -v -m
    HP-UX B.11.11 U 9000/785
    

    Compiler is:
    $ aCC --version
    aCC: HP ANSI C++ B3910B A.03.70
    

    I haven't yet run the examples, but will try to do that today.
  • tctimmehtctimmeh Member Tim CourtOrganization: Enbridge PipelinesProject: Historical Data Retriever
    Finally got to those demos and they did indeed tell me what I needed to know. The demos are linking with libxnet and my make was not. Adding xnet to my build fixes the problem.

    Is this documented anywhere and I just missed it? It's a bit scary because everything builds ok without xnet but fails at runtime.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Tim,

    Ice is built with _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED defined, so you need to link your Ice-based programs with -lxnet.

    We'll update the documentation to point this out.

    Thanks,
    Bernard
Sign In or Register to comment.