I'm wondering if anyone has a kqueue outgoing socket example. What I mean is something that uses kqueue and connects to somewhere (in the example, let's say on port 1234), and then polls the socket and when it gets data, calls the function receive_data(data), with data being the data.


1. Sets up a kqueue queue, then using a socket and kqueue, connects to on port 1234.

2. Polls the socket and waits for a response, then calls receive_data(data). Then continues to do this. (not just connecting, waiting for a single line of data, then disconnecting)

Thank you very much!