This code always fails with the error SOCKET_CONNECT_REFUSED, even when the server is running. I used gdb to trace through the code, and found out that the TCPStream constructor is receiving an InetHostAddress object with ipaddr = 0. This screws up the host name lookup that takes place, and the connect fails because it doesn't know who to connect to.
Am I doing something wrong? I'm using the posix version on a Debian Linux (Potato) with g++ version 2.95.2. Thanks for the help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay, I've tried my program on a Sun machine with gnu 2.95.2. It works there because the reference to InetHostAddress doesn't become zero in the constructor of TCPStream. I really can't think of a reason why this would screw up in Linux with the same version of the c++ compiler, but it does.
Any help would be appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am going to build a test case for this. You might want to look at my comments in
regard to config.def as well, for it may be a compiler options issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I was testing out the TCPStream class, but I cannot get it to work. The code is below
InetHostAddress servingComputer(argv[1]);
TCPStream clientStream(servingComputer, portnumber);
This code always fails with the error SOCKET_CONNECT_REFUSED, even when the server is running. I used gdb to trace through the code, and found out that the TCPStream constructor is receiving an InetHostAddress object with ipaddr = 0. This screws up the host name lookup that takes place, and the connect fails because it doesn't know who to connect to.
Am I doing something wrong? I'm using the posix version on a Debian Linux (Potato) with g++ version 2.95.2. Thanks for the help.
Do you get the same error if you do something like this:
InetAddress addr = argv[1];
??
No. It doesn't work with that.
Is the way I'm trying to use it the correct way to use it, or is it something unusual?
Thanks for the help.
Okay, I've tried my program on a Sun machine with gnu 2.95.2. It works there because the reference to InetHostAddress doesn't become zero in the constructor of TCPStream. I really can't think of a reason why this would screw up in Linux with the same version of the c++ compiler, but it does.
Any help would be appreciated.
I am going to build a test case for this. You might want to look at my comments in
regard to config.def as well, for it may be a compiler options issue.