Re: how to use the same udp port already loaded by launchd?
Re: how to use the same udp port already loaded by launchd?
- Subject: Re: how to use the same udp port already loaded by launchd?
- From: Jens Alfke <email@hidden>
- Date: Thu, 16 Jul 2009 07:54:58 -0700
On Jul 16, 2009, at 5:09 AM, Ian Mark Salvame wrote:
I have a client app binding port12345 for sending packets to a
certain server.
The server will store the client's port number(that is 12345).
Then the client closes and quits.
I have a launchd agent which is different from the client app but
located in the same host.
This launchd agent will be listening to port12345, so if the server
sends a packet using the stored port number(12345)
the launchd agent will launch and read the packet.
Just don't use the same port for the client and the agent. Instead,
have the client send the agent's port number as part of the packet it
sends.
- Client opens a UDP socket without binding to any particular port (it
gets a random port #, but you don't care)
- Client sends server a packet, including a field saying "write back
care of port 12345".
- Server later sends a packet back, using port 12345 as requested.
- Launchd agent receives the packet.
If you don't like this asymmetry, another choice is to make the
launchd agent in charge of sending packets as well as receiving them.
Use an IPC mechanism of some sort (Distributed Objects, Mach messages,
Unix domain socket) to have the client send the request to the agent,
then the agent sends the packet from its port 12345.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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