0

For server.accept I wrote a completion handler that has the parameters.

When the handler is invoked via the accept method, does that mean the AsynchronousSocketChannel is now conneted?

Or do I have to invoke the AsynchronousSocketChannel.connect method?

Right now what I think is going on is that AsynchronousServerSocketChannel.accept accepts a connection (and stores it in the AsynchronousSocketChannel parameter) , and that AsynchronousSocketChannel.connect also initiates a connection from server to client (stores in the socket channel).

Am I on the right track?

1 Answers1

0

When the handler is invoked via the accept method, does that mean the AsynchronousSocketChannel is now conneted?

Yes.

Or do I have to invoke the AsynchronousSocketChannel.connect method?

No.

Right now what I think is going on is that AsynchronousServerSocketChannel.accept accepts a connection (and stores it in the AsynchronousSocketChannel parameter)

Yes.

and that AsynchronousSocketChannel.connect also initiates a connection from server to client (stores in the socket channel).

No. Obviously you haven't tried it. It would fail.

accept() is for servers. connect() is for clients.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Thanks that is what I was thinking. I am working on my 1st barebones implementation & design. It sounds like what I have will work once I write the test client. – SmoothB1983 May 01 '13 at 00:37