jdiehl / async-network

Cocoa and iOS Socket Networking Evolved
http://jdiehl.github.com/async-network
MIT License
91 stars 31 forks source link

Feature - Individual sendCommand in AsyncServer and AsyncClient #7

Closed willSapgreen closed 9 years ago

willSapgreen commented 9 years ago

Hello Jason,

In AsyncServer and AsyncClient, sendCommand method will send object to all connected AsyncConnections.

Is it possible to send object to specific AsyncConnection? For example, the API will look like

With your permission, I can write this method and you can review it.

P.S. I don't know if there is a "Feature" to create in Github. So I use "Issues" instead. Sorry for any inconvenience.

jdiehl commented 9 years ago

If you have the connection object, you can use the method sendCommand:object:responseBlock: directly on that connection object. The client doesn't need to know ;)

willSapgreen commented 9 years ago

Thank you for the quick response. In sendCommand:object:responseBlock method, the command and object will be sent to all connections. In my understanding, the object is the data you want to send, not the connection(AsyncConnection). So if there are multiple connections, how to send the command and the object to the specific one in those connections. Sorry my previous description is unclear.

jdiehl commented 9 years ago

The connection object also has this method, allowing you to send something to one specific host.

On 08 May 2015, at 17:24, willSapgreen notifications@github.com wrote:

Thank you for the quick response. In sendCommand:object:responseBlock method, the command and object will be sent to all connections. In my understanding, the object is the data you want to send, not the connection(AsyncConnection). So if there are multiple connections, how to send the command and the object to the specific one in those connections. Sorry my previous description is unclear.

— Reply to this email directly or view it on GitHub.

willSapgreen commented 9 years ago

Hello Jason, Finally I may know what you are talking about. Is the "connection object" you mentioned is NSMutableSet *connections in either AsyncClient or AsyncServer? So I can use the AsyncConnection in connections to send something to one specific host/client. Thank you for helping.