gethostbyname - problem

Hello!

I started programming a network application
in C++ using sockets.
I´m using QNX 4.25 and TCP-IP toolkit and the include files:

#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netdb.h>


The line:

h= gethostbyname(“node1”);

causes an error

“No message of desired type”

in the output window and the program stops.




The functions “gethostbyname” and “gethostbyaddress” etc.
are shown in the .h -files, but no source code.
So I can´t see, which source code causes the error message.

Have you any idea,

a) what causes the error

b) WHERE CAN I FIND THE SOURCE OF ALL THESE
NETWORK COMMANDS, or at least a description of their
input Parameters. Only things like “(*char, int, int)” are shown
in the .h files, but not, which integer Values are required and
what thei´re for.

Thank you!

Ingo

Ingo Gross <ingo.gross@zess.uni-siegen.de> wrote:

Hello!

I started programming a network application
in C++ using sockets.
I´m using QNX 4.25 and TCP-IP toolkit and the include files:

#include <errno.h
#include <stdio.h
#include <unistd.h
#include <sys/types.h
#include <sys/socket.h
#include <sys/wait.h
#include <netinet/in.h
#include <netdb.h


The line:

h= gethostbyname(“node1”);

causes an error

“No message of desired type”

in the output window and the program stops.



The functions “gethostbyname” and “gethostbyaddress” etc.
are shown in the .h -files, but no source code.
So I can´t see, which source code causes the error message.

Have you any idea,

a) what causes the error

b) WHERE CAN I FIND THE SOURCE OF ALL THESE
NETWORK COMMANDS, or at least a description of their
input Parameters. Only things like “(*char, int, int)” are shown
in the .h files, but not, which integer Values are required and
what thei´re for.

Thank you!

Ingo

The TCP/IP utilities (and their arguments) are described in the
TCP/IP User’s Guide (part# 1837) and the functions are described
in the TCP/IP Programmer’s Guide (part# 1838).
The books for QNX 4.25 may be ordered through your sales rep.

Ingo Gross <ingo.gross@zess.uni-siegen.de> wrote:

Hello!

I started programming a network application
in C++ using sockets.
I’m using QNX 4.25 and TCP-IP toolkit and the include files:

#include <errno.h
#include <stdio.h
#include <unistd.h
#include <sys/types.h
#include <sys/socket.h
#include <sys/wait.h
#include <netinet/in.h
#include <netdb.h


The line:

h= gethostbyname(“node1”);

causes an error

“No message of desired type”

in the output window and the program stops.

Can you give a more complete sample of your code?


The functions “gethostbyname” and “gethostbyaddress” etc.
are shown in the .h -files, but no source code.
So I can’t see, which source code causes the error message.

Have you any idea,

a) what causes the error

I can’t see enough of your code to guess. That looks like the
message corresponding to errno 35, ENOMSG. But, when using
gethostbyname, you are supposed to check h_errno for errors,
not errno. (And herror() to display it, not perror.)

b) WHERE CAN I FIND THE SOURCE OF ALL THESE
NETWORK COMMANDS, or at least a description of their
input Parameters. Only things like “(*char, int, int)” are shown
in the .h files, but not, which integer Values are required and
what they’re for.

Library functions aren’t generally supplied as source code. For
information on calling them, check the online documentation.


-David

QNX Training Services
dagibbs@qnx.com