iOS and OS X Network Programming Cookbook
上QQ阅读APP看书,第一时间看更新

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "This recipe will introduce libnet_init() and libnet_destroy() functions."

A block of code is set as follows:

libnet_t *lnet;
 u_int32_t target, source;
 u_int16_t id,seq;
 char payload[] = "Hello from libnet";
 char errbuf[LIBNET_ERRBUF_SIZE];

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#import <Foundation/Foundation.h>
 
 #define LISTENQ 1024
 #define MAXLINE 4096
 
 typedef NS_ENUM(NSUInteger, BSDServerErrorCode) {
    NOERROR,
    SOCKETERROR,
    BINDERROR,
    LISTENERROR,
    ACCEPTINGERROR
}; 
 @interface BSDSocketServer : NSObject
 
 @property int errorCode, listenfd;
 
 -(id)initOnPort:(int)port;
 -(void)echoServerListenWithDescriptor:(int)lfd;
 -(void)dataServerListenWithDescriptor:(int)lfd;
 
 @end

Any command-line input or output is written as follows:

cd ~/Downloads
tar xopf libnet-1.2-rc2.tar
cd libnet-1.2-rc2

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "To run your project as root, from the top menu navigate to Project | Scheme | Edit Scheme as shown in the following screenshot:"

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.