• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
socket shutdown leaking FCBs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

socket shutdown leaking FCBs


  • Subject: socket shutdown leaking FCBs
  • From: Jeff Heyob <email@hidden>
  • Date: Thu, 27 Jan 2005 18:46:13 -0500

Hi,

I have a CFNetwork server app that accepts connections for large data transfers that needs to refuse connection requests under certain conditions.

CFSocketCreate is provided with the following callback:

void Network::ServerCall(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *nativeSocketH)
{
#pragma unused(s)
struct sockaddr_in* aptr;
Network* net = nil;
UInt32 peerAddress = 0;
SInt32 err;
switch(type)
{
case kCFSocketAcceptCallBack:
if(address != nil)
{
aptr = (struct sockaddr_in*)CFDataGetBytePtr(address);
peerAddress = aptr->sin_addr.s_addr;
}
net = AcceptConnectionSelf(peerAddress);
if(net != nil)
{
if(net->AcceptConnection(address,*((CFSocketNativeHandle*) nativeSocketH)) == false)
{
delete net;
net = nil;
}
}
if(net == nil)
{
sSocketRefusedCount++;
err = shutdown(*(int*) nativeSocketH, SHUT_RDWR); if(err != 0)
{
sSocketShutdownErrorCount++;
}
}
break;
default:
break;
}
}


The problem:
When I refuse a connection, 'net' is set to nil which then routes the nativeSocketH to the call shutdown().
I use sSocketRefusedCount to debug the number of refusals and sSocketShutdownErrorCount to track the number of errors from shutdown(). sSocketShutdownErrorCount remains at zero which tells me that shutdown() is working. However, over time the number of file control blocks for the app reaches 256 then the app dies.


What else needs to be done when refusing a socket connection so that the network resources are actually released?
Do I need to call release on nativeSocketH?


Thanks in advance,
Jeff

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: socket shutdown leaking FCBs
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: kCFStreamErrorHTTPParseFailure?
  • Next by Date: Re: socket shutdown leaking FCBs
  • Previous by thread: Re: system socket library?
  • Next by thread: Re: socket shutdown leaking FCBs
  • Index(es):
    • Date
    • Thread