concept send in category ios

appears as: send
iOS 4 in Action: Developing iPhone and iPad Apps

This is an excerpt from Manning's book iOS 4 in Action: Developing iPhone and iPad Apps.

On the other hand, if your application doesn’t rely so much on speed, you can send high-level objects and greatly reduce the complexity of your application. For the simple chat application, you convert strings to NSData, send them over the network, and convert them back into strings. In the next listing you’ll see how to implement the receiveData method as well as the send method.

Listing 15.3. Implementing the receiveData and send methods

The send and receive methods are a crucial part of the application because they do much of the heavy lifting. They’re also where most of the complexity associated with networking lies.

You can implement the send method in any number of ways. Apple has created a sample send method in the GKTanks application that can be used in most situations. Here, you take that method and use it directly. In general, send takes in some data, adds a header and packet ID, and sends the data over the network. The following listing shows how this method is implemented.

iPhone and iPad in Action: Introduction to SDK Development

This is an excerpt from Manning's book iPhone and iPad in Action: Introduction to SDK Development.

On the other hand, if your application doesn’t rely so much on speed, you can send high-level objects and greatly reduce the complexity of your application. For the simple chat application, you convert strings to NSData, send them over the network, and convert them back into strings. Listing 15.3 shows how to implement the receiveData method as well as the send method.

Listing 15.3. Implementing the receiveData and send methods

The send and receive methods are a crucial part of the application because they do much of the heavy lifting. They’re also where most of the complexity associated with networking lies.

You can implement the send method in any number of ways. Apple has created a sample send method in the GKTanks application that can be used in most situations. Here, you take that method and use it directly. In general, send takes in some data, adds a header and packet ID, and sends the data over the network. Listing 15.7 shows how this method is implemented.