Socket problem

Socket problem

Post by jdrumm on B » Wed, 17 May 1995 04:00:00

I have been playing around with some socket code under
Solaris 2.4 x86 which I cannot get to work.

The code is very straight forward, from "Unix Network Programming"
by W. Richard Stevens.  I've used the code before on other platforms,
and it of course worked.

I create the socket:

sockfd=socket(AF_INET, SOCK_STREAM, 0);

serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(SERVER_PORT);

bind(sockfd, (struct sockaddr *)&serv_addr, sizeof serv_addr);


The call to socket() works, bind fails and sets errno to 22.

Is there something different I need to do w/Solaris, or am I
missing something?




1. Interesting Sockets Problem (between generic sockets client and Sybase?)


I have a UNIX sockets client application making a connection to a sockets
server that I have also written. For the most part things have been
working great.

However, when this sockets client shared library that I have written is
brought into an application that also makes a connection to Sybase
problems occur. The problem is that the first time we make a connection
to our sockets server everything works OK; however, the next time we make
a connection to our sockets server application the host address
information is that of the host where the Sybase server is. If there is a
delay (say a sleep of 1 second) everthing works as expected.

The logic goes something like:

        1. Establish connection to Sybase.

        2. Query Sybase (the connection is left open).

        3. Establish connection to my sockets server. Build and retain
           local "struct  hostent" to remember information for remote
        4. Exchange data w/ sockets server.

        5. Close connection to my sockets server.

        6. Query Sybase (the connection is left open).

        7. Establish connection to my sockets server using retained
           local "struct hostent".

Note: That if a sleep of 1 second is performed between steps 6 and 7
everything works OK. If a sleep is not performed then the connection in
step 7 is attempted against the host that the Sybase server is on. NOT

I am developing on HP-UX on an HP9000.

Anyone have any ideas on what is going on here??? HELP!!


Jim Lundell,

Opinions expressed herein are my own and may not represent those of 3M.

2. Matrox MGA-G100 AGP.

3. socket help and other sockets problems !?!?

4. Simple question...

5. ISDN Router problem/socket problem

6. Linux ISP! No more TIAC

7. Java 1.3 socket problem in 420R with Solaris 5.7

8. mount multisession cd ?

9. FTP and Data socket problem

10. socket problem in Solaris

11. Socket problems

12. AF_INET socket problem

13. Socket problem