• 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
CFsockets and speed of execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFsockets and speed of execution


  • Subject: CFsockets and speed of execution
  • From: Jeremy Thompson <email@hidden>
  • Date: Fri, 15 Aug 2014 12:49:09 -0700
  • Thread-topic: CFsockets and speed of execution

I'm working on an application that would be slated as legacy code.  Its been ported from using OpenTransport to Cfosckets.  The network side of things runs in a cfrunloop and accepts on a callback then receives data on a callback.  Inside this receive callback function are the calls to rest of the software.  The software is single threaded and this work fairly well as the routines won't get called until all data is received.  Also inside this function  once the routines are done it sends the result data back out to the socket descriptor using cfsocketsenddata.  This code seems to work very fast but as more traffic comes in… lets say 40 requests per second it seems like its backing up.  The time it takes for the receive data function to complete is about 2ms to 12ms depending on the complexity of the data returned.  Should I be sending my data back to the end user via the receive data callback function or is that costly.  I'm starting to wonder if they are on a slow connection its taking a long time to finish and its holding up other connections.  I'm using these socket flags right now.

setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));

setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes));

setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(yes));


Here is the structure of it all.


Void setupconnection()

{

Setupstuff here and register accept callback

}


Void acceptcallback()

{

Make sure the connection works set up context for data register receive data callback

}


Void receive data()

{

Bring in data


Make calls to answer questions for end user


Pack up answers


Send answers via cfsocketsenddata


Close connection and release response data

}


Its stumping me a bit as this code seems to really work fast but I still don't have full understanding of CoreFoundations.  There seems to be a bit of a tipping point when many people are connected at once I'd say at least around 60 connections.  Any info would be great.  Thanks.


~Jeremy

 _______________________________________________
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: CFsockets and speed of execution
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: NSURLSessionTask after uninstall?
  • Next by Date: Re: CFsockets and speed of execution
  • Previous by thread: Re: NSURLSession timeouts
  • Next by thread: Re: CFsockets and speed of execution
  • Index(es):
    • Date
    • Thread