Subject: | |
From: | |
Reply To: | James Clark,Florida |
Date: | Mon, 14 Feb 2000 11:36:13 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
A thought would be to send a packet to indicate that you are shutting down,
then check whether you have graceful shutdown set or not. If it is important
to get that socket closed, do a hard shutdown. Could lose data that is
waiting to be sent though. But the best would be since you are only
suffering this problem on 10% of the connects, just check the status of the
connect, if failure add to a counter and wait a few seconds and try again.
Only fail when your counter reaches some value you preset. Then you are only
waiting on the sockets which are in error and not all of them.
The last suggestion is if you cannot get the socket to close when asked to
do so. We had that problem, but solved it by having both the server and
client close the socket.
James
> -----Original Message-----
> From: HP-3000 Systems Discussion [mailto:[log in to unmask]]On
> Behalf Of Noam Koren
> Sent: Monday, February 14, 2000 7:43 AM
> To: [log in to unmask]
> Subject: Socket 'connect' Error
>
>
> Hello,
>
> I would like to ask your advise for a problem I have:
>
> I have a 'thin' tcp client program that creates a tcp connection to Unix
> tcp server, sends something 'close' the socket fd and exits.
>
> I run this program inside a loop for few 10's.
>
> Some of the invokations (appx 10%) fails due to tcp error I get after
> 'connect':
> The errno is 22 (EINVAL). In rare cases I get 241 (hostisdown).
>
> When I put a delay (say 5 secs) in the loop, all succeed.
>
> Do you have in mind an advise what to do in order to safely open the new
> connection?
>
> TIA,
> Noam
>
|
|
|