OSDN Git Service

Added a method to specify the interface to use for outgoing connection
[syncr/master.git] / CocoaAsyncSocket / CocoaAsyncSocket-5.6.2 / InterfaceTest / Readme.txt
1 InterfaceTest is an iPhone project that demonstrates some of AsyncSocket's interface abilities.
2
3 Most machines have multiple network interfaces. For example:
4 - Ethernet
5 - WiFi
6 - 3G (cellular)
7 - Bluetooth
8 - Loopback (local machine only)
9
10 Which leads to the question:
11 If you are setting up sockets, which interface will your socket be running on?
12
13 By default, if you don't specify an inteface, then the following rules generally apply:
14
15 - Server sockets (listening/accepting) will accept incoming connections on any inteface.
16 - Client sockets (connecting) will make outgoing connections on the primary interface.
17
18 The primary interface on iPhone is WiFi.
19 The primary interface on Mac is configurable via system preferences.
20
21 But you can specify a particular interface using AsyncSocket.  There are various examples of when one might want to do this.
22
23 - You're trying to make a bluetooth connection.
24
25 - Your iPhone app only supports WiFi, so you need to ensure your socket is only using the WiFi interface.
26
27 - You want to create a local-only server socket on Mac for inter-process communication. You want to ensure only processes running on the local device can connect to your server.
28
29
30 The IntefaceTest project demonstrates specifying a particular interface to use for an outgoing connection to google.com. You can force either the WiFi interface or the 3G/cellular interface.