• 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
Re: legacy code and OT random source port
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: legacy code and OT random source port


  • Subject: Re: legacy code and OT random source port
  • From: Vincent Lubet <email@hidden>
  • Date: Wed, 9 Jun 2004 09:31:12 -0700

Melissa,

When you call TEndpoint::Bind(TBind*reqAddr, TBind* retAddr) with the port set to zero in the reqAddr the system assigns an "ephemeral" port to the endpoint and the value of this port is returned retAddr. On OS X ephemeral ports are taken from the range [49152, 65535]. The port is kept with the endpoint until it is unbound or closed. It seems this meets perfectly your needs, and you do not need anything special.

Vincent


On Jun 9, 2004, at 8:50 AM, Melissa Graesser wrote:

We have a legacy product that is using OT and endpoints. It connects to a
windows service on a NT server box on a specific port. We used to specify
the source port but have run into problem with one of our customers when
they switched to new networking software and load balancing. The server
does not send a reset so even after we close the port it is not free
until it times out on the server which is 4 minutes. We have changed the
code to get a random number for the source port using ::OTGetRandomNumber
(&seed, 49152, 65535) for OS 9, and use that when we init using
OTInitInetAddress and the bind using TEndpoint.

This works fine on OS 9, but for OS X these calls are not available. I
also do not think it is valid to specify a source port but if I pass zero
in as the port for OTInitInetAddress and then bind it will give me a
unique port each time I call the bind using TEndpoint::Bind(TBind*
reqAddr, TBind* retAddr) in the receiving InetAddress structure but this
is not bound correctly because from the technotes I have read the
requested port is suppose to equal the received port in the InetAddress
structure. Do you know the correct way to get a unique source port for OS
X open transport. I do not want to use bsd sockets because the
application is going to be replaced with a web application soon and it
has a short life expectancy.

Thanks,

Melissa
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


References: 
 >legacy code and OT random source port (From: "Melissa Graesser" <email@hidden>)

  • Prev by Date: legacy code and OT random source port
  • Next by Date: Proper usage of OTAsyncOpenEndpointInContext()
  • Previous by thread: legacy code and OT random source port
  • Next by thread: Proper usage of OTAsyncOpenEndpointInContext()
  • Index(es):
    • Date
    • Thread