realbasic-nug
[Top] [All Lists]

Re: Sockets in Carbon

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Sockets in Carbon
From: Lou Forlini <lforlini at sspi-software dot com>
Date: Wed, 30 Jan 2002 23:29:47 -0500
At 8:40 PM -0500 1/30/02, James Sentman wrote:
When running on OSX it's vital that you keep track of whether your
sockets are open or closed and not call the close method when it's
closed or more than once.

Especially in a timeout situation you may be calling close in some
cleanup method. All sorts of interesting things happen if you call
close more than once.

Walk the code and make sure that no matter what happens you're not
closing the socket when it's not open. After my last post on this
problem I have gotten emails from literally dozens of people that
couldn't figure out why they were crashing and it turned out they
were just calling close in a couple of different places. Which
didn't cause any problems under OS9, but under OSX it's murder.

James,

   I am having a similar problem with OS X sockets.

Do you know if there is an implicit Close being done when an Error event is received, i.e. should I not be doing a Close if I receive an error?

I know I also have the situation you mention, where I do a close on error and later another close during my socket cleanup. I'm definitely going to change it so only 1 close will ever get done, and see if things improve.

   Regards,

   - Lou Forlini
     Software Engineer
     System Support Products, Inc.


<Prev in Thread] Current Thread [Next in Thread>