Operating System - HP-UX
1753341 Members
5177 Online
108792 Solutions
New Discussion юеВ

Re: The connect function faild when linking with libxnet.sl

 
SOLVED
Go to solution
zfm_1
Occasional Advisor

Re: The connect function faild when linking with libxnet.sl

thanks dennis very much for your help and support
Dennis Handly
Acclaimed Contributor

Re: The connect function faild when linking with libxnet.sl

>i try to use /usr/lib/hpux64/libxnet.so

One issue with a 64 bit application, socklen_t and size_t may have different sizes. So unless you are looking and correcting warnings, they may be picking up bogus lengths.
Michael Lutz  CA
New Member

Re: The connect function faild when linking with libxnet.sl

The xnet library supports the XOPEN socket calls while the c library supports the HPUX sockets. HP has advised developers to move from the HPUX sockets to XOPEN. I am having trouble with the XOPEN sockets hanging but working properly with the HPUX sockets. It makes me wonder if all my sources have the correct -D defines in place. Does anyone know if there is a way to test the executable (or object files) to see which socket protocol is being referenced?
Dennis Handly
Acclaimed Contributor

Re: The connect function faild when linking with libxnet.sl

>Michael: if all my sources have the correct -D defines in place. Does anyone know if there is a way to test the executable (or object files) to see which socket protocol is being referenced?

First of all, do you know the differences with the -D? If this just changes the instructions, that would be hard to check. If it changes the functions, you could scan with nm(1). Of course you could have the wrong shlib, so just looking at chatr(1) may not help.
amit dwivedi
New Member

Re: The connect function faild when linking with libxnet.sl

Important points:
1.In prior releases, if an executable includes binary objects compiled to X/Open Sockets and binary objects compiled to BSD specification, it may result in unexpected
behavior, including abnormal termination and unexpected socket errors. This
problem can now be avoided by:

├в Define _HPUX_ALT_XOPEN_SOCKET_API, in addition to either defining
_XOPEN_SOURCE=600 in UNIX03, or _XOPEN_SOURCE and
_XOPEN_SOURCE_EXTENDED in UNIX95;
├в Link with C library instead of Xnet library. Xnet library should not be included
in the link line.

2.The following interfaces and system calls are impacted by UNIX 2003 Conformance:
├в To conform to UNIX 2003, customers must define _XOPEN_SOURCE to 600. To
conform to UNIX 95, customers must continue to define _XOPEN_SOURCE and
_XOPEN_SOURCE_EXTENDED. Please note that applications using the X/Open
Sockets must be linked with the Xnet library for UNIX 2003 and UNIX 95 conformance.

The points are from HP-UX 11i Version 3 Release Notes

3.from man page(xopen_networking(7))
Note if the C library is also specified in the link line, the Xnetlibrary has to be specified before the C library. Otherwise, X/Open Sockets calls would have been resolved to BSD Sockets functions in the C library instead of X/Open Sockets functions in the Xnet library.

the above statement is a contradictory as both libc and xnet library are in the same directory.

I guess that was the main problem.
FINAL WORDS:
I guess HP has correct this problem in release B.11.31(current release level of the operating, uname -r)
amit dwivedi
New Member

Re: The connect function faild when linking with libxnet.sl

>>the above statement is a contradictory as both libc and xnet library are in the same directory.

please accept my apologies for the above wrong statement.