Socket connections using shared libraries

Socket connections using shared libraries

Post by Geoff Bone » Fri, 14 Jul 1995 04:00:00



We are experiencing problems establishing socket connections between processes using the shared
socket library libsocket.so, under Solaris 2.3.  The processes connect fine on the site where
the binaries were compiled and linked, but taking the binaries to other sites is gives
unpredictable results: some sites experience no problems, other sites find the connection
fails 100%.  Recompiling and linking at the foreign site solves the problem.

Does anyone have any idea how we compile and link binaries on Solaris 2.3 that will run
reliably on other Solaris 2.x sites?  At the moment we use dynamic libraries, and no -R
option on the link, setting LD_LIBRARY_PATH at each site as appropriate.

Geoff Bones

 
 
 

Socket connections using shared libraries

Post by Geoff Bone » Fri, 14 Jul 1995 04:00:00


We are experiencing problems establishing socket connections between processes using the shared
socket library libsocket.so, under Solaris 2.3.  The processes connect fine on the site where
the binaries were compiled and linked, but taking the binaries to other sites is gives
unpredictable results: some sites experience no problems, other sites find the connection
fails 100%.  Recompiling and linking at the foreign site solves the problem.

Does anyone have any idea how we compile and link binaries on Solaris 2.3 that will run
reliably on other Solaris 2.x sites?  At the moment we use dynamic libraries, and no -R
option on the link, setting LD_LIBRARY_PATH at each site as appropriate.

Geoff Bones

 
 
 

1. problem with socket code (well, it uses socket libraries anyway)

I'm having problems compiling my code, I sort of understand the error,
but I don't know how to correct the problem, here's the error:
detect.c: In Function 'main':
detect.c:21: warning: comparison of distinct pointer types lacks a
cast

now heres the source code. What I'm atleast trying to do is get the
address of the user and well, give different output for certain users.
I think I got it, I think I just need to reorganize/fix some stuff.
Help would be appreciated.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>  
int main()

{
        int addr;

        struct sockaddr_in their_addr;
        struct hostent *name;

        their_addr.sin_family = AF_INET;
        their_addr.sin_port = htons (80);
        addr = inet_aton (getenv("REMOTE_ADDR"),&(their_addr.sin_addr));
        memset (&(their_addr.sin_zero),'\0',8);
if ((name=gethostbyaddr (&addr,sizeof(addr),AF_INET)) ==
"location.com")
        {

                printf ("Hello");
          exit(0);
        }

        else {

                printf ("Hey");
                exit (0);
        }

2. formating disk-basic question?

3. Using static libraries and shared libraries in same program?

4. rpm src-tar mess... any good solutions?

5. Using libtool to build shared libraries that depend on static libraries

6. 2 (easy?) shell-script questions

7. Will strip(debug shared library) == nodebug shared library ?

8. Performance metering with logging/averageing options for Solaris?

9. Help with building shared libraries with dependencies on other shared libraries

10. Question: Inclusion of shared libraries during linking of shared libraries

11. Shared library loading shared library.

12. Need a Shared Library Guru: beyond simple shared library question

13. When is a shared library not a shared library?