├── .DS_Store └── CocoaSyncSocket ├── .DS_Store ├── CocoaSyncSocket.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── tuyaohui.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── tuyaohui.xcuserdatad │ └── xcschemes │ ├── CocoaSyncSocket.xcscheme │ └── xcschememanagement.plist ├── CocoaSyncSocket.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── tuyaohui.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── CocoaSyncSocket ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── TYHSocketManager.h ├── TYHSocketManager.m ├── ViewController.h ├── ViewController.m └── main.m ├── CocoaSyncSocketTests ├── CocoaSyncSocketTests.m └── Info.plist ├── CocoaSyncSocketUITests ├── CocoaSyncSocketUITests.m └── Info.plist ├── Podfile.lock ├── Pods ├── CocoaAsyncSocket │ ├── README.markdown │ └── Source │ │ └── GCD │ │ ├── GCDAsyncSocket.h │ │ ├── GCDAsyncSocket.m │ │ ├── GCDAsyncUdpSocket.h │ │ └── GCDAsyncUdpSocket.m ├── Headers │ ├── Private │ │ └── CocoaAsyncSocket │ │ │ ├── GCDAsyncSocket.h │ │ │ └── GCDAsyncUdpSocket.h │ └── Public │ │ └── CocoaAsyncSocket │ │ ├── GCDAsyncSocket.h │ │ └── GCDAsyncUdpSocket.h ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── tuyaohui.xcuserdatad │ │ └── xcschemes │ │ ├── CocoaAsyncSocket.xcscheme │ │ ├── Pods-CocoaSyncSocket.xcscheme │ │ └── xcschememanagement.plist └── Target Support Files │ ├── CocoaAsyncSocket │ ├── CocoaAsyncSocket-dummy.m │ ├── CocoaAsyncSocket-prefix.pch │ └── CocoaAsyncSocket.xcconfig │ └── Pods-CocoaSyncSocket │ ├── Pods-CocoaSyncSocket-acknowledgements.markdown │ ├── Pods-CocoaSyncSocket-acknowledgements.plist │ ├── Pods-CocoaSyncSocket-dummy.m │ ├── Pods-CocoaSyncSocket-frameworks.sh │ ├── Pods-CocoaSyncSocket-resources.sh │ ├── Pods-CocoaSyncSocket.debug.xcconfig │ └── Pods-CocoaSyncSocket.release.xcconfig └── podfile /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuyaohui/CocoaAsyncSocketTip/cce8114d27f0e1914619c9bfa195930ce6c825bc/.DS_Store -------------------------------------------------------------------------------- /CocoaSyncSocket/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuyaohui/CocoaAsyncSocketTip/cce8114d27f0e1914619c9bfa195930ce6c825bc/CocoaSyncSocket/.DS_Store -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1EB662DF0E46DE2442AEA0D3 /* libPods-CocoaSyncSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D90EBDACD94F0BDB5CA65278 /* libPods-CocoaSyncSocket.a */; }; 11 | 5AC5061C1E135B3300B2AB8C /* TYHSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AC5061B1E135B3300B2AB8C /* TYHSocketManager.m */; }; 12 | 5AFBA80D1E10F067007E1578 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AFBA80C1E10F067007E1578 /* main.m */; }; 13 | 5AFBA8101E10F067007E1578 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AFBA80F1E10F067007E1578 /* AppDelegate.m */; }; 14 | 5AFBA8131E10F067007E1578 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AFBA8121E10F067007E1578 /* ViewController.m */; }; 15 | 5AFBA8161E10F067007E1578 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AFBA8141E10F067007E1578 /* Main.storyboard */; }; 16 | 5AFBA8181E10F067007E1578 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5AFBA8171E10F067007E1578 /* Assets.xcassets */; }; 17 | 5AFBA81B1E10F067007E1578 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AFBA8191E10F067007E1578 /* LaunchScreen.storyboard */; }; 18 | 5AFBA8261E10F067007E1578 /* CocoaSyncSocketTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AFBA8251E10F067007E1578 /* CocoaSyncSocketTests.m */; }; 19 | 5AFBA8311E10F067007E1578 /* CocoaSyncSocketUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AFBA8301E10F067007E1578 /* CocoaSyncSocketUITests.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 5AFBA8221E10F067007E1578 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 5AFBA8001E10F067007E1578 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 5AFBA8071E10F067007E1578; 28 | remoteInfo = CocoaSyncSocket; 29 | }; 30 | 5AFBA82D1E10F067007E1578 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 5AFBA8001E10F067007E1578 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 5AFBA8071E10F067007E1578; 35 | remoteInfo = CocoaSyncSocket; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 5AC5061A1E135B3300B2AB8C /* TYHSocketManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TYHSocketManager.h; sourceTree = ""; }; 41 | 5AC5061B1E135B3300B2AB8C /* TYHSocketManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TYHSocketManager.m; sourceTree = ""; }; 42 | 5AFBA8081E10F067007E1578 /* CocoaSyncSocket.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CocoaSyncSocket.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 5AFBA80C1E10F067007E1578 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 5AFBA80E1E10F067007E1578 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 5AFBA80F1E10F067007E1578 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 5AFBA8111E10F067007E1578 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 47 | 5AFBA8121E10F067007E1578 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 48 | 5AFBA8151E10F067007E1578 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | 5AFBA8171E10F067007E1578 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | 5AFBA81A1E10F067007E1578 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | 5AFBA81C1E10F067007E1578 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 5AFBA8211E10F067007E1578 /* CocoaSyncSocketTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CocoaSyncSocketTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 5AFBA8251E10F067007E1578 /* CocoaSyncSocketTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CocoaSyncSocketTests.m; sourceTree = ""; }; 54 | 5AFBA8271E10F067007E1578 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 5AFBA82C1E10F067007E1578 /* CocoaSyncSocketUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CocoaSyncSocketUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 5AFBA8301E10F067007E1578 /* CocoaSyncSocketUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CocoaSyncSocketUITests.m; sourceTree = ""; }; 57 | 5AFBA8321E10F067007E1578 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | A5B380C312F63DE11565460F /* Pods-CocoaSyncSocket.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CocoaSyncSocket.release.xcconfig"; path = "Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket.release.xcconfig"; sourceTree = ""; }; 59 | D90EBDACD94F0BDB5CA65278 /* libPods-CocoaSyncSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CocoaSyncSocket.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | DE84D96AD13CFA369D80EC06 /* Pods-CocoaSyncSocket.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CocoaSyncSocket.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket.debug.xcconfig"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 5AFBA8051E10F067007E1578 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 1EB662DF0E46DE2442AEA0D3 /* libPods-CocoaSyncSocket.a in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 5AFBA81E1E10F067007E1578 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 5AFBA8291E10F067007E1578 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | /* End PBXFrameworksBuildPhase section */ 87 | 88 | /* Begin PBXGroup section */ 89 | 12A271AFB61FA8EDC8167BE0 /* Pods */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | DE84D96AD13CFA369D80EC06 /* Pods-CocoaSyncSocket.debug.xcconfig */, 93 | A5B380C312F63DE11565460F /* Pods-CocoaSyncSocket.release.xcconfig */, 94 | ); 95 | name = Pods; 96 | sourceTree = ""; 97 | }; 98 | 5AFBA7FF1E10F067007E1578 = { 99 | isa = PBXGroup; 100 | children = ( 101 | 5AFBA80A1E10F067007E1578 /* CocoaSyncSocket */, 102 | 5AFBA8241E10F067007E1578 /* CocoaSyncSocketTests */, 103 | 5AFBA82F1E10F067007E1578 /* CocoaSyncSocketUITests */, 104 | 5AFBA8091E10F067007E1578 /* Products */, 105 | 12A271AFB61FA8EDC8167BE0 /* Pods */, 106 | 791191617027A527F1994D94 /* Frameworks */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 5AFBA8091E10F067007E1578 /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 5AFBA8081E10F067007E1578 /* CocoaSyncSocket.app */, 114 | 5AFBA8211E10F067007E1578 /* CocoaSyncSocketTests.xctest */, 115 | 5AFBA82C1E10F067007E1578 /* CocoaSyncSocketUITests.xctest */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 5AFBA80A1E10F067007E1578 /* CocoaSyncSocket */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 5AFBA80E1E10F067007E1578 /* AppDelegate.h */, 124 | 5AFBA80F1E10F067007E1578 /* AppDelegate.m */, 125 | 5AFBA8111E10F067007E1578 /* ViewController.h */, 126 | 5AFBA8121E10F067007E1578 /* ViewController.m */, 127 | 5AC5061A1E135B3300B2AB8C /* TYHSocketManager.h */, 128 | 5AC5061B1E135B3300B2AB8C /* TYHSocketManager.m */, 129 | 5AFBA8141E10F067007E1578 /* Main.storyboard */, 130 | 5AFBA8171E10F067007E1578 /* Assets.xcassets */, 131 | 5AFBA8191E10F067007E1578 /* LaunchScreen.storyboard */, 132 | 5AFBA81C1E10F067007E1578 /* Info.plist */, 133 | 5AFBA80B1E10F067007E1578 /* Supporting Files */, 134 | ); 135 | path = CocoaSyncSocket; 136 | sourceTree = ""; 137 | }; 138 | 5AFBA80B1E10F067007E1578 /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 5AFBA80C1E10F067007E1578 /* main.m */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | 5AFBA8241E10F067007E1578 /* CocoaSyncSocketTests */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 5AFBA8251E10F067007E1578 /* CocoaSyncSocketTests.m */, 150 | 5AFBA8271E10F067007E1578 /* Info.plist */, 151 | ); 152 | path = CocoaSyncSocketTests; 153 | sourceTree = ""; 154 | }; 155 | 5AFBA82F1E10F067007E1578 /* CocoaSyncSocketUITests */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 5AFBA8301E10F067007E1578 /* CocoaSyncSocketUITests.m */, 159 | 5AFBA8321E10F067007E1578 /* Info.plist */, 160 | ); 161 | path = CocoaSyncSocketUITests; 162 | sourceTree = ""; 163 | }; 164 | 791191617027A527F1994D94 /* Frameworks */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | D90EBDACD94F0BDB5CA65278 /* libPods-CocoaSyncSocket.a */, 168 | ); 169 | name = Frameworks; 170 | sourceTree = ""; 171 | }; 172 | /* End PBXGroup section */ 173 | 174 | /* Begin PBXNativeTarget section */ 175 | 5AFBA8071E10F067007E1578 /* CocoaSyncSocket */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 5AFBA8351E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocket" */; 178 | buildPhases = ( 179 | B09D3266B3C5CDC78CB5CF48 /* [CP] Check Pods Manifest.lock */, 180 | 5AFBA8041E10F067007E1578 /* Sources */, 181 | 5AFBA8051E10F067007E1578 /* Frameworks */, 182 | 5AFBA8061E10F067007E1578 /* Resources */, 183 | 938B15A79F8306B9EA66554D /* [CP] Embed Pods Frameworks */, 184 | A2846E485B35AD278E5F181E /* [CP] Copy Pods Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | ); 190 | name = CocoaSyncSocket; 191 | productName = CocoaSyncSocket; 192 | productReference = 5AFBA8081E10F067007E1578 /* CocoaSyncSocket.app */; 193 | productType = "com.apple.product-type.application"; 194 | }; 195 | 5AFBA8201E10F067007E1578 /* CocoaSyncSocketTests */ = { 196 | isa = PBXNativeTarget; 197 | buildConfigurationList = 5AFBA8381E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocketTests" */; 198 | buildPhases = ( 199 | 5AFBA81D1E10F067007E1578 /* Sources */, 200 | 5AFBA81E1E10F067007E1578 /* Frameworks */, 201 | 5AFBA81F1E10F067007E1578 /* Resources */, 202 | ); 203 | buildRules = ( 204 | ); 205 | dependencies = ( 206 | 5AFBA8231E10F067007E1578 /* PBXTargetDependency */, 207 | ); 208 | name = CocoaSyncSocketTests; 209 | productName = CocoaSyncSocketTests; 210 | productReference = 5AFBA8211E10F067007E1578 /* CocoaSyncSocketTests.xctest */; 211 | productType = "com.apple.product-type.bundle.unit-test"; 212 | }; 213 | 5AFBA82B1E10F067007E1578 /* CocoaSyncSocketUITests */ = { 214 | isa = PBXNativeTarget; 215 | buildConfigurationList = 5AFBA83B1E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocketUITests" */; 216 | buildPhases = ( 217 | 5AFBA8281E10F067007E1578 /* Sources */, 218 | 5AFBA8291E10F067007E1578 /* Frameworks */, 219 | 5AFBA82A1E10F067007E1578 /* Resources */, 220 | ); 221 | buildRules = ( 222 | ); 223 | dependencies = ( 224 | 5AFBA82E1E10F067007E1578 /* PBXTargetDependency */, 225 | ); 226 | name = CocoaSyncSocketUITests; 227 | productName = CocoaSyncSocketUITests; 228 | productReference = 5AFBA82C1E10F067007E1578 /* CocoaSyncSocketUITests.xctest */; 229 | productType = "com.apple.product-type.bundle.ui-testing"; 230 | }; 231 | /* End PBXNativeTarget section */ 232 | 233 | /* Begin PBXProject section */ 234 | 5AFBA8001E10F067007E1578 /* Project object */ = { 235 | isa = PBXProject; 236 | attributes = { 237 | LastUpgradeCheck = 0820; 238 | ORGANIZATIONNAME = "涂耀辉"; 239 | TargetAttributes = { 240 | 5AFBA8071E10F067007E1578 = { 241 | CreatedOnToolsVersion = 8.2.1; 242 | DevelopmentTeam = EETMANEHFQ; 243 | ProvisioningStyle = Automatic; 244 | }; 245 | 5AFBA8201E10F067007E1578 = { 246 | CreatedOnToolsVersion = 8.2.1; 247 | ProvisioningStyle = Automatic; 248 | TestTargetID = 5AFBA8071E10F067007E1578; 249 | }; 250 | 5AFBA82B1E10F067007E1578 = { 251 | CreatedOnToolsVersion = 8.2.1; 252 | ProvisioningStyle = Automatic; 253 | TestTargetID = 5AFBA8071E10F067007E1578; 254 | }; 255 | }; 256 | }; 257 | buildConfigurationList = 5AFBA8031E10F067007E1578 /* Build configuration list for PBXProject "CocoaSyncSocket" */; 258 | compatibilityVersion = "Xcode 3.2"; 259 | developmentRegion = English; 260 | hasScannedForEncodings = 0; 261 | knownRegions = ( 262 | en, 263 | Base, 264 | ); 265 | mainGroup = 5AFBA7FF1E10F067007E1578; 266 | productRefGroup = 5AFBA8091E10F067007E1578 /* Products */; 267 | projectDirPath = ""; 268 | projectRoot = ""; 269 | targets = ( 270 | 5AFBA8071E10F067007E1578 /* CocoaSyncSocket */, 271 | 5AFBA8201E10F067007E1578 /* CocoaSyncSocketTests */, 272 | 5AFBA82B1E10F067007E1578 /* CocoaSyncSocketUITests */, 273 | ); 274 | }; 275 | /* End PBXProject section */ 276 | 277 | /* Begin PBXResourcesBuildPhase section */ 278 | 5AFBA8061E10F067007E1578 /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 5AFBA81B1E10F067007E1578 /* LaunchScreen.storyboard in Resources */, 283 | 5AFBA8181E10F067007E1578 /* Assets.xcassets in Resources */, 284 | 5AFBA8161E10F067007E1578 /* Main.storyboard in Resources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | 5AFBA81F1E10F067007E1578 /* Resources */ = { 289 | isa = PBXResourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | 5AFBA82A1E10F067007E1578 /* Resources */ = { 296 | isa = PBXResourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXResourcesBuildPhase section */ 303 | 304 | /* Begin PBXShellScriptBuildPhase section */ 305 | 938B15A79F8306B9EA66554D /* [CP] Embed Pods Frameworks */ = { 306 | isa = PBXShellScriptBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | ); 310 | inputPaths = ( 311 | ); 312 | name = "[CP] Embed Pods Frameworks"; 313 | outputPaths = ( 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | shellPath = /bin/sh; 317 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-frameworks.sh\"\n"; 318 | showEnvVarsInLog = 0; 319 | }; 320 | A2846E485B35AD278E5F181E /* [CP] Copy Pods Resources */ = { 321 | isa = PBXShellScriptBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | ); 325 | inputPaths = ( 326 | ); 327 | name = "[CP] Copy Pods Resources"; 328 | outputPaths = ( 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | shellPath = /bin/sh; 332 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-resources.sh\"\n"; 333 | showEnvVarsInLog = 0; 334 | }; 335 | B09D3266B3C5CDC78CB5CF48 /* [CP] Check Pods Manifest.lock */ = { 336 | isa = PBXShellScriptBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | ); 340 | inputPaths = ( 341 | ); 342 | name = "[CP] Check Pods Manifest.lock"; 343 | outputPaths = ( 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | shellPath = /bin/sh; 347 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 348 | showEnvVarsInLog = 0; 349 | }; 350 | /* End PBXShellScriptBuildPhase section */ 351 | 352 | /* Begin PBXSourcesBuildPhase section */ 353 | 5AFBA8041E10F067007E1578 /* Sources */ = { 354 | isa = PBXSourcesBuildPhase; 355 | buildActionMask = 2147483647; 356 | files = ( 357 | 5AFBA8131E10F067007E1578 /* ViewController.m in Sources */, 358 | 5AFBA8101E10F067007E1578 /* AppDelegate.m in Sources */, 359 | 5AC5061C1E135B3300B2AB8C /* TYHSocketManager.m in Sources */, 360 | 5AFBA80D1E10F067007E1578 /* main.m in Sources */, 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | }; 364 | 5AFBA81D1E10F067007E1578 /* Sources */ = { 365 | isa = PBXSourcesBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | 5AFBA8261E10F067007E1578 /* CocoaSyncSocketTests.m in Sources */, 369 | ); 370 | runOnlyForDeploymentPostprocessing = 0; 371 | }; 372 | 5AFBA8281E10F067007E1578 /* Sources */ = { 373 | isa = PBXSourcesBuildPhase; 374 | buildActionMask = 2147483647; 375 | files = ( 376 | 5AFBA8311E10F067007E1578 /* CocoaSyncSocketUITests.m in Sources */, 377 | ); 378 | runOnlyForDeploymentPostprocessing = 0; 379 | }; 380 | /* End PBXSourcesBuildPhase section */ 381 | 382 | /* Begin PBXTargetDependency section */ 383 | 5AFBA8231E10F067007E1578 /* PBXTargetDependency */ = { 384 | isa = PBXTargetDependency; 385 | target = 5AFBA8071E10F067007E1578 /* CocoaSyncSocket */; 386 | targetProxy = 5AFBA8221E10F067007E1578 /* PBXContainerItemProxy */; 387 | }; 388 | 5AFBA82E1E10F067007E1578 /* PBXTargetDependency */ = { 389 | isa = PBXTargetDependency; 390 | target = 5AFBA8071E10F067007E1578 /* CocoaSyncSocket */; 391 | targetProxy = 5AFBA82D1E10F067007E1578 /* PBXContainerItemProxy */; 392 | }; 393 | /* End PBXTargetDependency section */ 394 | 395 | /* Begin PBXVariantGroup section */ 396 | 5AFBA8141E10F067007E1578 /* Main.storyboard */ = { 397 | isa = PBXVariantGroup; 398 | children = ( 399 | 5AFBA8151E10F067007E1578 /* Base */, 400 | ); 401 | name = Main.storyboard; 402 | sourceTree = ""; 403 | }; 404 | 5AFBA8191E10F067007E1578 /* LaunchScreen.storyboard */ = { 405 | isa = PBXVariantGroup; 406 | children = ( 407 | 5AFBA81A1E10F067007E1578 /* Base */, 408 | ); 409 | name = LaunchScreen.storyboard; 410 | sourceTree = ""; 411 | }; 412 | /* End PBXVariantGroup section */ 413 | 414 | /* Begin XCBuildConfiguration section */ 415 | 5AFBA8331E10F067007E1578 /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | ALWAYS_SEARCH_USER_PATHS = NO; 419 | CLANG_ANALYZER_NONNULL = YES; 420 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 421 | CLANG_CXX_LIBRARY = "libc++"; 422 | CLANG_ENABLE_MODULES = YES; 423 | CLANG_ENABLE_OBJC_ARC = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 428 | CLANG_WARN_EMPTY_BODY = YES; 429 | CLANG_WARN_ENUM_CONVERSION = YES; 430 | CLANG_WARN_INFINITE_RECURSION = YES; 431 | CLANG_WARN_INT_CONVERSION = YES; 432 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 433 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 434 | CLANG_WARN_UNREACHABLE_CODE = YES; 435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 436 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 437 | COPY_PHASE_STRIP = NO; 438 | DEBUG_INFORMATION_FORMAT = dwarf; 439 | ENABLE_STRICT_OBJC_MSGSEND = YES; 440 | ENABLE_TESTABILITY = YES; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_DYNAMIC_NO_PIC = NO; 443 | GCC_NO_COMMON_BLOCKS = YES; 444 | GCC_OPTIMIZATION_LEVEL = 0; 445 | GCC_PREPROCESSOR_DEFINITIONS = ( 446 | "DEBUG=1", 447 | "$(inherited)", 448 | ); 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 456 | MTL_ENABLE_DEBUG_INFO = YES; 457 | ONLY_ACTIVE_ARCH = YES; 458 | SDKROOT = iphoneos; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | }; 461 | name = Debug; 462 | }; 463 | 5AFBA8341E10F067007E1578 /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ALWAYS_SEARCH_USER_PATHS = NO; 467 | CLANG_ANALYZER_NONNULL = YES; 468 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 469 | CLANG_CXX_LIBRARY = "libc++"; 470 | CLANG_ENABLE_MODULES = YES; 471 | CLANG_ENABLE_OBJC_ARC = YES; 472 | CLANG_WARN_BOOL_CONVERSION = YES; 473 | CLANG_WARN_CONSTANT_CONVERSION = YES; 474 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 475 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 476 | CLANG_WARN_EMPTY_BODY = YES; 477 | CLANG_WARN_ENUM_CONVERSION = YES; 478 | CLANG_WARN_INFINITE_RECURSION = YES; 479 | CLANG_WARN_INT_CONVERSION = YES; 480 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 481 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 482 | CLANG_WARN_UNREACHABLE_CODE = YES; 483 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 484 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 485 | COPY_PHASE_STRIP = NO; 486 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 487 | ENABLE_NS_ASSERTIONS = NO; 488 | ENABLE_STRICT_OBJC_MSGSEND = YES; 489 | GCC_C_LANGUAGE_STANDARD = gnu99; 490 | GCC_NO_COMMON_BLOCKS = YES; 491 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 492 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 493 | GCC_WARN_UNDECLARED_SELECTOR = YES; 494 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 495 | GCC_WARN_UNUSED_FUNCTION = YES; 496 | GCC_WARN_UNUSED_VARIABLE = YES; 497 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 498 | MTL_ENABLE_DEBUG_INFO = NO; 499 | SDKROOT = iphoneos; 500 | TARGETED_DEVICE_FAMILY = "1,2"; 501 | VALIDATE_PRODUCT = YES; 502 | }; 503 | name = Release; 504 | }; 505 | 5AFBA8361E10F067007E1578 /* Debug */ = { 506 | isa = XCBuildConfiguration; 507 | baseConfigurationReference = DE84D96AD13CFA369D80EC06 /* Pods-CocoaSyncSocket.debug.xcconfig */; 508 | buildSettings = { 509 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 510 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 511 | DEVELOPMENT_TEAM = EETMANEHFQ; 512 | INFOPLIST_FILE = CocoaSyncSocket/Info.plist; 513 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 515 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocket; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | }; 518 | name = Debug; 519 | }; 520 | 5AFBA8371E10F067007E1578 /* Release */ = { 521 | isa = XCBuildConfiguration; 522 | baseConfigurationReference = A5B380C312F63DE11565460F /* Pods-CocoaSyncSocket.release.xcconfig */; 523 | buildSettings = { 524 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 525 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 526 | DEVELOPMENT_TEAM = EETMANEHFQ; 527 | INFOPLIST_FILE = CocoaSyncSocket/Info.plist; 528 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 530 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocket; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | }; 533 | name = Release; 534 | }; 535 | 5AFBA8391E10F067007E1578 /* Debug */ = { 536 | isa = XCBuildConfiguration; 537 | buildSettings = { 538 | BUNDLE_LOADER = "$(TEST_HOST)"; 539 | INFOPLIST_FILE = CocoaSyncSocketTests/Info.plist; 540 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 541 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocketTests; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CocoaSyncSocket.app/CocoaSyncSocket"; 544 | }; 545 | name = Debug; 546 | }; 547 | 5AFBA83A1E10F067007E1578 /* Release */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | BUNDLE_LOADER = "$(TEST_HOST)"; 551 | INFOPLIST_FILE = CocoaSyncSocketTests/Info.plist; 552 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 553 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocketTests; 554 | PRODUCT_NAME = "$(TARGET_NAME)"; 555 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CocoaSyncSocket.app/CocoaSyncSocket"; 556 | }; 557 | name = Release; 558 | }; 559 | 5AFBA83C1E10F067007E1578 /* Debug */ = { 560 | isa = XCBuildConfiguration; 561 | buildSettings = { 562 | INFOPLIST_FILE = CocoaSyncSocketUITests/Info.plist; 563 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 564 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocketUITests; 565 | PRODUCT_NAME = "$(TARGET_NAME)"; 566 | TEST_TARGET_NAME = CocoaSyncSocket; 567 | }; 568 | name = Debug; 569 | }; 570 | 5AFBA83D1E10F067007E1578 /* Release */ = { 571 | isa = XCBuildConfiguration; 572 | buildSettings = { 573 | INFOPLIST_FILE = CocoaSyncSocketUITests/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 575 | PRODUCT_BUNDLE_IDENTIFIER = tyh.CocoaSyncSocketUITests; 576 | PRODUCT_NAME = "$(TARGET_NAME)"; 577 | TEST_TARGET_NAME = CocoaSyncSocket; 578 | }; 579 | name = Release; 580 | }; 581 | /* End XCBuildConfiguration section */ 582 | 583 | /* Begin XCConfigurationList section */ 584 | 5AFBA8031E10F067007E1578 /* Build configuration list for PBXProject "CocoaSyncSocket" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 5AFBA8331E10F067007E1578 /* Debug */, 588 | 5AFBA8341E10F067007E1578 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | 5AFBA8351E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocket" */ = { 594 | isa = XCConfigurationList; 595 | buildConfigurations = ( 596 | 5AFBA8361E10F067007E1578 /* Debug */, 597 | 5AFBA8371E10F067007E1578 /* Release */, 598 | ); 599 | defaultConfigurationIsVisible = 0; 600 | defaultConfigurationName = Release; 601 | }; 602 | 5AFBA8381E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocketTests" */ = { 603 | isa = XCConfigurationList; 604 | buildConfigurations = ( 605 | 5AFBA8391E10F067007E1578 /* Debug */, 606 | 5AFBA83A1E10F067007E1578 /* Release */, 607 | ); 608 | defaultConfigurationIsVisible = 0; 609 | defaultConfigurationName = Release; 610 | }; 611 | 5AFBA83B1E10F067007E1578 /* Build configuration list for PBXNativeTarget "CocoaSyncSocketUITests" */ = { 612 | isa = XCConfigurationList; 613 | buildConfigurations = ( 614 | 5AFBA83C1E10F067007E1578 /* Debug */, 615 | 5AFBA83D1E10F067007E1578 /* Release */, 616 | ); 617 | defaultConfigurationIsVisible = 0; 618 | defaultConfigurationName = Release; 619 | }; 620 | /* End XCConfigurationList section */ 621 | }; 622 | rootObject = 5AFBA8001E10F067007E1578 /* Project object */; 623 | } 624 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcodeproj/project.xcworkspace/xcuserdata/tuyaohui.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuyaohui/CocoaAsyncSocketTip/cce8114d27f0e1914619c9bfa195930ce6c825bc/CocoaSyncSocket/CocoaSyncSocket.xcodeproj/project.xcworkspace/xcuserdata/tuyaohui.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcodeproj/xcuserdata/tuyaohui.xcuserdatad/xcschemes/CocoaSyncSocket.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 88 | 89 | 90 | 91 | 92 | 93 | 99 | 101 | 107 | 108 | 109 | 110 | 112 | 113 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcodeproj/xcuserdata/tuyaohui.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CocoaSyncSocket.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5AFBA8071E10F067007E1578 16 | 17 | primary 18 | 19 | 20 | 5AFBA8201E10F067007E1578 21 | 22 | primary 23 | 24 | 25 | 5AFBA82B1E10F067007E1578 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcworkspace/xcuserdata/tuyaohui.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuyaohui/CocoaAsyncSocketTip/cce8114d27f0e1914619c9bfa195930ce6c825bc/CocoaSyncSocket/CocoaSyncSocket.xcworkspace/xcuserdata/tuyaohui.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket.xcworkspace/xcuserdata/tuyaohui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 104 | 116 | 117 | 118 | 120 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuyaohui/CocoaAsyncSocketTip/cce8114d27f0e1914619c9bfa195930ce6c825bc/CocoaSyncSocket/CocoaSyncSocket/.DS_Store -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | 21 | 22 | return YES; 23 | } 24 | 25 | 26 | - (void)applicationWillResignActive:(UIApplication *)application { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 29 | } 30 | 31 | 32 | - (void)applicationDidEnterBackground:(UIApplication *)application { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | 38 | - (void)applicationWillEnterForeground:(UIApplication *)application { 39 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | 43 | - (void)applicationDidBecomeActive:(UIApplication *)application { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | 48 | - (void)applicationWillTerminate:(UIApplication *)application { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/TYHSocketManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TYHSocketManager.h 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/28. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | 10 | 11 | 12 | #import 13 | 14 | @interface TYHSocketManager : NSObject 15 | 16 | + (instancetype)share; 17 | 18 | - (BOOL)connect; 19 | - (void)disConnect; 20 | 21 | - (void)sendMsg:(NSString *)msg; 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/TYHSocketManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // TYHSocketManager.m 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/28. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import "TYHSocketManager.h" 10 | #import "GCDAsyncSocket.h" // for TCP 11 | 12 | 13 | static NSString * Khost = @"127.0.0.1"; 14 | static const uint16_t Kport = 6969; 15 | 16 | 17 | @interface TYHSocketManager() 18 | { 19 | GCDAsyncSocket *gcdSocket; 20 | } 21 | 22 | @end 23 | 24 | @implementation TYHSocketManager 25 | 26 | + (instancetype)share 27 | { 28 | static dispatch_once_t onceToken; 29 | static TYHSocketManager *instance = nil; 30 | dispatch_once(&onceToken, ^{ 31 | instance = [[self alloc]init]; 32 | [instance initSocket]; 33 | }); 34 | return instance; 35 | } 36 | 37 | - (void)initSocket 38 | { 39 | gcdSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; 40 | 41 | } 42 | 43 | #pragma mark - 对外的一些接口 44 | 45 | //建立连接 46 | - (BOOL)connect 47 | { 48 | return [gcdSocket connectToHost:Khost onPort:Kport error:nil]; 49 | // return [gcdSocket connectToUrl:[NSURL fileURLWithPath:@"/Users/tuyaohui/IPCTest"] withTimeout:-1 error:nil]; 50 | } 51 | 52 | //断开连接 53 | - (void)disConnect 54 | { 55 | [gcdSocket disconnect]; 56 | } 57 | 58 | //字典转为Json字符串 59 | - (NSString *)dictionaryToJson:(NSDictionary *)dic 60 | { 61 | NSError *error = nil; 62 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error]; 63 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 64 | } 65 | 66 | 67 | 68 | //发送消息 69 | - (void)sendMsg:(NSString *)msg 70 | { 71 | 72 | NSData *data = [@"你好" dataUsingEncoding:NSUTF8StringEncoding]; 73 | NSData *data1 = [@"猪头" dataUsingEncoding:NSUTF8StringEncoding]; 74 | NSData *data2 = [@"先生" dataUsingEncoding:NSUTF8StringEncoding]; 75 | 76 | 77 | NSData *data3 = [@"今天天气好" dataUsingEncoding:NSUTF8StringEncoding]; 78 | NSData *data4 = [@"吃饭了吗" dataUsingEncoding:NSUTF8StringEncoding]; 79 | 80 | [self sendData:data :@"txt"]; 81 | [self sendData:data1 :@"txt"]; 82 | [self sendData:data2 :@"txt"]; 83 | [self sendData:data3 :@"txt"]; 84 | [self sendData:data4 :@"txt"]; 85 | 86 | // NSString *filePath = [[NSBundle mainBundle]pathForResource:@"test1" ofType:@"jpg"]; 87 | // 88 | // NSData *data5 = [NSData dataWithContentsOfFile:filePath]; 89 | // 90 | // [self sendData:data5 :@"img"]; 91 | } 92 | 93 | - (void)sendData:(NSData *)data :(NSString *)type 94 | { 95 | NSUInteger size = data.length; 96 | 97 | NSMutableDictionary *headDic = [NSMutableDictionary dictionary]; 98 | [headDic setObject:type forKey:@"type"]; 99 | [headDic setObject:[NSString stringWithFormat:@"%ld",size] forKey:@"size"]; 100 | NSString *jsonStr = [self dictionaryToJson:headDic]; 101 | 102 | 103 | NSData *lengthData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding]; 104 | 105 | 106 | NSMutableData *mData = [NSMutableData dataWithData:lengthData]; 107 | //分界 108 | [mData appendData:[GCDAsyncSocket CRLFData]]; 109 | 110 | [mData appendData:data]; 111 | 112 | 113 | //第二个参数,请求超时时间 114 | [gcdSocket writeData:mData withTimeout:-1 tag:110]; 115 | 116 | } 117 | 118 | //监听最新的消息 119 | - (void)pullTheMsg 120 | { 121 | //貌似是分段读数据的方法 122 | // [gcdSocket readDataToData:[GCDAsyncSocket CRLFData] withTimeout:10 maxLength:50000 tag:110]; 123 | 124 | //监听读数据的代理,只能监听10秒,10秒过后调用代理方法 -1永远监听,不超时,但是只收一次消息, 125 | //所以每次接受到消息还得调用一次 126 | [gcdSocket readDataWithTimeout:-1 tag:110]; 127 | 128 | } 129 | 130 | //用Pingpong机制来看是否有反馈 131 | - (void)checkPingPong 132 | { 133 | //pingpong设置为3秒,如果3秒内没得到反馈就会自动断开连接 134 | [gcdSocket readDataWithTimeout:3 tag:110]; 135 | 136 | } 137 | 138 | 139 | 140 | #pragma mark - GCDAsyncSocketDelegate 141 | //连接成功调用 142 | - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port 143 | { 144 | NSLog(@"连接成功,host:%@,port:%d",host,port); 145 | 146 | [self pullTheMsg]; 147 | 148 | [sock startTLS:nil]; 149 | 150 | //心跳写在这... 151 | } 152 | 153 | //断开连接的时候调用 154 | - (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(nullable NSError *)err 155 | { 156 | NSLog(@"断开连接,host:%@,port:%d",sock.localHost,sock.localPort); 157 | 158 | //断线重连写在这... 159 | 160 | } 161 | 162 | //写的回调 163 | - (void)socket:(GCDAsyncSocket*)sock didWriteDataWithTag:(long)tag 164 | { 165 | NSLog(@"写的回调,tag:%ld",tag); 166 | //判断是否成功发送,如果没收到响应,则说明连接断了,则想办法重连 167 | [self pullTheMsg]; 168 | } 169 | 170 | 171 | - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag 172 | { 173 | 174 | NSString *msg = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; 175 | NSLog(@"收到消息:%@",msg); 176 | 177 | [self pullTheMsg]; 178 | } 179 | 180 | //Unix domain socket 181 | //- (void)socket:(GCDAsyncSocket *)sock didConnectToUrl:(NSURL *)url 182 | //{ 183 | // NSLog(@"connect:%@",[url absoluteString]); 184 | //} 185 | 186 | // //看能不能读到这条消息发送成功的回调消息,如果2秒内没收到,则断开连接 187 | // [gcdSocket readDataToData:[GCDAsyncSocket CRLFData] withTimeout:2 maxLength:50000 tag:110]; 188 | 189 | //貌似触发点 190 | - (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag 191 | { 192 | 193 | NSLog(@"读的回调,length:%ld,tag:%ld",partialLength,tag); 194 | 195 | } 196 | 197 | 198 | //为上一次设置的读取数据代理续时 (如果设置超时为-1,则永远不会调用到) 199 | //-(NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag elapsed:(NSTimeInterval)elapsed bytesDone:(NSUInteger)length 200 | //{ 201 | // NSLog(@"来延时,tag:%ld,elapsed:%f,length:%ld",tag,elapsed,length); 202 | // return 10; 203 | //} 204 | 205 | 206 | 207 | 208 | 209 | @end 210 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TYHSocketManager.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UITextField *sendFiled; 15 | 16 | @property (weak, nonatomic) IBOutlet UIButton *sendBtn; 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *recieveLal; 19 | 20 | @property (weak, nonatomic) IBOutlet UIButton *connectBtn; 21 | 22 | @property (weak, nonatomic) IBOutlet UIButton *disConnectBtn; 23 | 24 | @property (nonatomic,strong)NSThread *thread; 25 | 26 | 27 | @end 28 | 29 | @implementation ViewController 30 | 31 | - (void)viewDidLoad { 32 | [super viewDidLoad]; 33 | 34 | 35 | 36 | [_connectBtn addTarget:self action:@selector(connectAction) forControlEvents:UIControlEventTouchUpInside]; 37 | 38 | [_disConnectBtn addTarget:self action:@selector(disConnectAction) forControlEvents:UIControlEventTouchUpInside]; 39 | 40 | [_sendBtn addTarget:self action:@selector(sendAction) forControlEvents:UIControlEventTouchUpInside]; 41 | 42 | } 43 | 44 | 45 | //连接 46 | - (void)connectAction 47 | { 48 | [[TYHSocketManager share] connect]; 49 | 50 | } 51 | //断开连接 52 | - (void)disConnectAction 53 | { 54 | [[TYHSocketManager share] disConnect]; 55 | } 56 | 57 | //发送消息 58 | - (void)sendAction 59 | { 60 | if (_sendFiled.text.length == 0) { 61 | return; 62 | } 63 | [[TYHSocketManager share]sendMsg:_sendFiled.text]; 64 | } 65 | 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocket/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CocoaSyncSocket 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocketTests/CocoaSyncSocketTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaSyncSocketTests.m 3 | // CocoaSyncSocketTests 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CocoaSyncSocketTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CocoaSyncSocketTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocketTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocketUITests/CocoaSyncSocketUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaSyncSocketUITests.m 3 | // CocoaSyncSocketUITests 4 | // 5 | // Created by 涂耀辉 on 16/12/26. 6 | // Copyright © 2016年 涂耀辉. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CocoaSyncSocketUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CocoaSyncSocketUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CocoaSyncSocket/CocoaSyncSocketUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.5.0): 3 | - CocoaAsyncSocket/GCD (= 7.5.0) 4 | - CocoaAsyncSocket/GCD (7.5.0) 5 | 6 | DEPENDENCIES: 7 | - CocoaAsyncSocket 8 | 9 | SPEC CHECKSUMS: 10 | CocoaAsyncSocket: 3baeb1ddd969f81cf9fca81053ae49ef2d1cbbfa 11 | 12 | PODFILE CHECKSUM: b1e3a866736a9ab7dd4166c491d3b0851e5fdd89 13 | 14 | COCOAPODS: 1.0.1 15 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/CocoaAsyncSocket/README.markdown: -------------------------------------------------------------------------------- 1 | # CocoaAsyncSocket 2 | [![Build Status](https://travis-ci.org/robbiehanson/CocoaAsyncSocket.svg?branch=master)](https://travis-ci.org/robbiehanson/CocoaAsyncSocket) [![Version Status](https://img.shields.io/cocoapods/v/CocoaAsyncSocket.svg?style=flat)](http://cocoadocs.org/docsets/CocoaAsyncSocket) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](http://img.shields.io/cocoapods/p/CocoaAsyncSocket.svg?style=flat)](http://cocoapods.org/?q=CocoaAsyncSocket) [![license Public Domain](https://img.shields.io/badge/license-Public%20Domain-orange.svg?style=flat)](https://en.wikipedia.org/wiki/Public_domain) 3 | 4 | 5 | CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below. 6 | 7 | ## Installation 8 | 9 | #### CocoaPods 10 | 11 | Install using [CocoaPods](http://cocoapods.org) by adding this line to your Podfile: 12 | 13 | ````ruby 14 | use_frameworks! # Add this if you are targeting iOS 8+ or using Swift 15 | pod 'CocoaAsyncSocket' 16 | ```` 17 | 18 | #### Carthage 19 | 20 | CocoaAsyncSocket is [Carthage](https://github.com/Carthage/Carthage) compatible. To include it add the following line to your `Cartfile` 21 | 22 | ```bash 23 | github "robbiehanson/CocoaAsyncSocket" "master" 24 | ``` 25 | 26 | The project is currently configured to build for **iOS**, **tvOS** and **Mac**. After building with carthage the resultant frameworks will be stored in: 27 | 28 | * `Carthage/Build/iOS/CocoaAsyncSocket.framework` 29 | * `Carthage/Build/tvOS/CocoaAsyncSocket.framework` 30 | * `Carthage/Build/Mac/CocoaAsyncSocket.framework` 31 | 32 | Select the correct framework(s) and drag it into your project. 33 | 34 | #### Manual 35 | 36 | You can also include it into your project by adding the source files directly, but you should probably be using a dependency manager to keep up to date. 37 | 38 | ### Importing 39 | 40 | Using Objective-C: 41 | 42 | ```obj-c 43 | // When using iOS 8+ frameworks 44 | @import CocoaAsyncSocket; 45 | 46 | // OR when not using frameworks, targeting iOS 7 or below 47 | #import "GCDAsyncSocket.h" // for TCP 48 | #import "GCDAsyncUdpSocket.h" // for UDP 49 | ``` 50 | 51 | Using Swift: 52 | 53 | ```swift 54 | import CocoaAsyncSocket 55 | ``` 56 | 57 | ## TCP 58 | 59 | **GCDAsyncSocket** is a TCP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: 60 | 61 | - Native objective-c, fully self-contained in one class.
62 | _No need to muck around with sockets or streams. This class handles everything for you._ 63 | 64 | - Full delegate support
65 | _Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method._ 66 | 67 | - Queued non-blocking reads and writes, with optional timeouts.
68 | _You tell it what to read or write, and it handles everything for you. Queueing, buffering, and searching for termination sequences within the stream - all handled for you automatically._ 69 | 70 | - Automatic socket acceptance.
71 | _Spin up a server socket, tell it to accept connections, and it will call you with new instances of itself for each connection._ 72 | 73 | - Support for TCP streams over IPv4 and IPv6.
74 | _Automatically connect to IPv4 or IPv6 hosts. Automatically accept incoming connections over both IPv4 and IPv6 with a single instance of this class. No more worrying about multiple sockets._ 75 | 76 | - Support for TLS / SSL
77 | _Secure your socket with ease using just a single method call. Available for both client and server sockets._ 78 | 79 | - Fully GCD based and Thread-Safe
80 | _It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code._ 81 | 82 | - The Latest Technology & Performance Optimizations
83 | _Internally the library takes advantage of technologies such as [kqueue's](http://en.wikipedia.org/wiki/Kqueue) to limit [system calls](http://en.wikipedia.org/wiki/System_call) and optimize buffer allocations. In other words, peak performance._ 84 | 85 | ## UDP 86 | 87 | **GCDAsyncUdpSocket** is a UDP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: 88 | 89 | - Native objective-c, fully self-contained in one class.
90 | _No need to muck around with low-level sockets. This class handles everything for you._ 91 | 92 | - Full delegate support.
93 | _Errors, send completions, receive completions, and disconnections all result in a call to your delegate method._ 94 | 95 | - Queued non-blocking send and receive operations, with optional timeouts.
96 | _You tell it what to send or receive, and it handles everything for you. Queueing, buffering, waiting and checking errno - all handled for you automatically._ 97 | 98 | - Support for IPv4 and IPv6.
99 | _Automatically send/recv using IPv4 and/or IPv6. No more worrying about multiple sockets._ 100 | 101 | - Fully GCD based and Thread-Safe
102 | _It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code._ 103 | 104 | *** 105 | 106 | Can't find the answer to your question in any of the [wiki](https://github.com/robbiehanson/CocoaAsyncSocket/wiki) articles? Try the **[mailing list](http://groups.google.com/group/cocoaasyncsocket)**. 107 |
108 |
109 | Love the project? Wanna buy me a coffee? (or a beer :D) [![donation](http://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2M8C699FQ8AW2) 110 | 111 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAsyncUdpSocket 3 | // 4 | // This class is in the public domain. 5 | // Originally created by Robbie Hanson of Deusty LLC. 6 | // Updated and maintained by Deusty LLC and the Apple development community. 7 | // 8 | // https://github.com/robbiehanson/CocoaAsyncSocket 9 | // 10 | 11 | #import 12 | #import 13 | #import 14 | #import 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | extern NSString *const GCDAsyncUdpSocketException; 18 | extern NSString *const GCDAsyncUdpSocketErrorDomain; 19 | 20 | extern NSString *const GCDAsyncUdpSocketQueueName; 21 | extern NSString *const GCDAsyncUdpSocketThreadName; 22 | 23 | typedef NS_ENUM(NSInteger, GCDAsyncUdpSocketError) { 24 | GCDAsyncUdpSocketNoError = 0, // Never used 25 | GCDAsyncUdpSocketBadConfigError, // Invalid configuration 26 | GCDAsyncUdpSocketBadParamError, // Invalid parameter was passed 27 | GCDAsyncUdpSocketSendTimeoutError, // A send operation timed out 28 | GCDAsyncUdpSocketClosedError, // The socket was closed 29 | GCDAsyncUdpSocketOtherError, // Description provided in userInfo 30 | }; 31 | 32 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 33 | #pragma mark - 34 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 | 36 | @class GCDAsyncUdpSocket; 37 | 38 | @protocol GCDAsyncUdpSocketDelegate 39 | @optional 40 | 41 | /** 42 | * By design, UDP is a connectionless protocol, and connecting is not needed. 43 | * However, you may optionally choose to connect to a particular host for reasons 44 | * outlined in the documentation for the various connect methods listed above. 45 | * 46 | * This method is called if one of the connect methods are invoked, and the connection is successful. 47 | **/ 48 | - (void)udpSocket:(GCDAsyncUdpSocket *)sock didConnectToAddress:(NSData *)address; 49 | 50 | /** 51 | * By design, UDP is a connectionless protocol, and connecting is not needed. 52 | * However, you may optionally choose to connect to a particular host for reasons 53 | * outlined in the documentation for the various connect methods listed above. 54 | * 55 | * This method is called if one of the connect methods are invoked, and the connection fails. 56 | * This may happen, for example, if a domain name is given for the host and the domain name is unable to be resolved. 57 | **/ 58 | - (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotConnect:(NSError *)error; 59 | 60 | /** 61 | * Called when the datagram with the given tag has been sent. 62 | **/ 63 | - (void)udpSocket:(GCDAsyncUdpSocket *)sock didSendDataWithTag:(long)tag; 64 | 65 | /** 66 | * Called if an error occurs while trying to send a datagram. 67 | * This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet. 68 | **/ 69 | - (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error; 70 | 71 | /** 72 | * Called when the socket has received the requested datagram. 73 | **/ 74 | - (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data 75 | fromAddress:(NSData *)address 76 | withFilterContext:(nullable id)filterContext; 77 | 78 | /** 79 | * Called when the socket is closed. 80 | **/ 81 | - (void)udpSocketDidClose:(GCDAsyncUdpSocket *)sock withError:(NSError *)error; 82 | 83 | @end 84 | 85 | /** 86 | * You may optionally set a receive filter for the socket. 87 | * A filter can provide several useful features: 88 | * 89 | * 1. Many times udp packets need to be parsed. 90 | * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. 91 | * The end result is a parallel socket io, datagram parsing, and packet processing. 92 | * 93 | * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. 94 | * The filter can prevent such packets from arriving at the delegate. 95 | * And because the filter can run in its own independent queue, this doesn't slow down the delegate. 96 | * 97 | * - Since the udp protocol does not guarantee delivery, udp packets may be lost. 98 | * Many protocols built atop udp thus provide various resend/re-request algorithms. 99 | * This sometimes results in duplicate packets arriving. 100 | * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. 101 | * 102 | * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. 103 | * Such packets need to be ignored. 104 | * 105 | * 3. Sometimes traffic shapers are needed to simulate real world environments. 106 | * A filter allows you to write custom code to simulate such environments. 107 | * The ability to code this yourself is especially helpful when your simulated environment 108 | * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), 109 | * or the system tools to handle this aren't available (e.g. on a mobile device). 110 | * 111 | * @param data - The packet that was received. 112 | * @param address - The address the data was received from. 113 | * See utilities section for methods to extract info from address. 114 | * @param context - Out parameter you may optionally set, which will then be passed to the delegate method. 115 | * For example, filter block can parse the data and then, 116 | * pass the parsed data to the delegate. 117 | * 118 | * @returns - YES if the received packet should be passed onto the delegate. 119 | * NO if the received packet should be discarded, and not reported to the delegete. 120 | * 121 | * Example: 122 | * 123 | * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { 124 | * 125 | * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; 126 | * 127 | * *context = response; 128 | * return (response != nil); 129 | * }; 130 | * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; 131 | * 132 | **/ 133 | typedef BOOL (^GCDAsyncUdpSocketReceiveFilterBlock)(NSData *data, NSData *address, id __nullable * __nonnull context); 134 | 135 | /** 136 | * You may optionally set a send filter for the socket. 137 | * A filter can provide several interesting possibilities: 138 | * 139 | * 1. Optional caching of resolved addresses for domain names. 140 | * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. 141 | * 142 | * 2. Reusable modules of code for bandwidth monitoring. 143 | * 144 | * 3. Sometimes traffic shapers are needed to simulate real world environments. 145 | * A filter allows you to write custom code to simulate such environments. 146 | * The ability to code this yourself is especially helpful when your simulated environment 147 | * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), 148 | * or the system tools to handle this aren't available (e.g. on a mobile device). 149 | * 150 | * @param data - The packet that was received. 151 | * @param address - The address the data was received from. 152 | * See utilities section for methods to extract info from address. 153 | * @param tag - The tag that was passed in the send method. 154 | * 155 | * @returns - YES if the packet should actually be sent over the socket. 156 | * NO if the packet should be silently dropped (not sent over the socket). 157 | * 158 | * Regardless of the return value, the delegate will be informed that the packet was successfully sent. 159 | * 160 | **/ 161 | typedef BOOL (^GCDAsyncUdpSocketSendFilterBlock)(NSData *data, NSData *address, long tag); 162 | 163 | 164 | @interface GCDAsyncUdpSocket : NSObject 165 | 166 | /** 167 | * GCDAsyncUdpSocket uses the standard delegate paradigm, 168 | * but executes all delegate callbacks on a given delegate dispatch queue. 169 | * This allows for maximum concurrency, while at the same time providing easy thread safety. 170 | * 171 | * You MUST set a delegate AND delegate dispatch queue before attempting to 172 | * use the socket, or you will get an error. 173 | * 174 | * The socket queue is optional. 175 | * If you pass NULL, GCDAsyncSocket will automatically create its own socket queue. 176 | * If you choose to provide a socket queue, the socket queue must not be a concurrent queue, 177 | * then please see the discussion for the method markSocketQueueTargetQueue. 178 | * 179 | * The delegate queue and socket queue can optionally be the same. 180 | **/ 181 | - (instancetype)init; 182 | - (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; 183 | - (instancetype)initWithDelegate:(nullable id )aDelegate delegateQueue:(nullable dispatch_queue_t)dq; 184 | - (instancetype)initWithDelegate:(nullable id )aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq; 185 | 186 | #pragma mark Configuration 187 | 188 | - (nullable id )delegate; 189 | - (void)setDelegate:(nullable id )delegate; 190 | - (void)synchronouslySetDelegate:(nullable id )delegate; 191 | 192 | - (nullable dispatch_queue_t)delegateQueue; 193 | - (void)setDelegateQueue:(nullable dispatch_queue_t)delegateQueue; 194 | - (void)synchronouslySetDelegateQueue:(nullable dispatch_queue_t)delegateQueue; 195 | 196 | - (void)getDelegate:(id __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; 197 | - (void)setDelegate:(nullable id )delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; 198 | - (void)synchronouslySetDelegate:(nullable id )delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; 199 | 200 | /** 201 | * By default, both IPv4 and IPv6 are enabled. 202 | * 203 | * This means GCDAsyncUdpSocket automatically supports both protocols, 204 | * and can send to IPv4 or IPv6 addresses, 205 | * as well as receive over IPv4 and IPv6. 206 | * 207 | * For operations that require DNS resolution, GCDAsyncUdpSocket supports both IPv4 and IPv6. 208 | * If a DNS lookup returns only IPv4 results, GCDAsyncUdpSocket will automatically use IPv4. 209 | * If a DNS lookup returns only IPv6 results, GCDAsyncUdpSocket will automatically use IPv6. 210 | * If a DNS lookup returns both IPv4 and IPv6 results, then the protocol used depends on the configured preference. 211 | * If IPv4 is preferred, then IPv4 is used. 212 | * If IPv6 is preferred, then IPv6 is used. 213 | * If neutral, then the first IP version in the resolved array will be used. 214 | * 215 | * Starting with Mac OS X 10.7 Lion and iOS 5, the default IP preference is neutral. 216 | * On prior systems the default IP preference is IPv4. 217 | **/ 218 | - (BOOL)isIPv4Enabled; 219 | - (void)setIPv4Enabled:(BOOL)flag; 220 | 221 | - (BOOL)isIPv6Enabled; 222 | - (void)setIPv6Enabled:(BOOL)flag; 223 | 224 | - (BOOL)isIPv4Preferred; 225 | - (BOOL)isIPv6Preferred; 226 | - (BOOL)isIPVersionNeutral; 227 | 228 | - (void)setPreferIPv4; 229 | - (void)setPreferIPv6; 230 | - (void)setIPVersionNeutral; 231 | 232 | /** 233 | * Gets/Sets the maximum size of the buffer that will be allocated for receive operations. 234 | * The default maximum size is 9216 bytes. 235 | * 236 | * The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535. 237 | * The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295. 238 | * 239 | * Since the OS/GCD notifies us of the size of each received UDP packet, 240 | * the actual allocated buffer size for each packet is exact. 241 | * And in practice the size of UDP packets is generally much smaller than the max. 242 | * Indeed most protocols will send and receive packets of only a few bytes, 243 | * or will set a limit on the size of packets to prevent fragmentation in the IP layer. 244 | * 245 | * If you set the buffer size too small, the sockets API in the OS will silently discard 246 | * any extra data, and you will not be notified of the error. 247 | **/ 248 | - (uint16_t)maxReceiveIPv4BufferSize; 249 | - (void)setMaxReceiveIPv4BufferSize:(uint16_t)max; 250 | 251 | - (uint32_t)maxReceiveIPv6BufferSize; 252 | - (void)setMaxReceiveIPv6BufferSize:(uint32_t)max; 253 | 254 | /** 255 | * User data allows you to associate arbitrary information with the socket. 256 | * This data is not used internally in any way. 257 | **/ 258 | - (nullable id)userData; 259 | - (void)setUserData:(nullable id)arbitraryUserData; 260 | 261 | #pragma mark Diagnostics 262 | 263 | /** 264 | * Returns the local address info for the socket. 265 | * 266 | * The localAddress method returns a sockaddr structure wrapped in a NSData object. 267 | * The localHost method returns the human readable IP address as a string. 268 | * 269 | * Note: Address info may not be available until after the socket has been binded, connected 270 | * or until after data has been sent. 271 | **/ 272 | - (nullable NSData *)localAddress; 273 | - (nullable NSString *)localHost; 274 | - (uint16_t)localPort; 275 | 276 | - (nullable NSData *)localAddress_IPv4; 277 | - (nullable NSString *)localHost_IPv4; 278 | - (uint16_t)localPort_IPv4; 279 | 280 | - (nullable NSData *)localAddress_IPv6; 281 | - (nullable NSString *)localHost_IPv6; 282 | - (uint16_t)localPort_IPv6; 283 | 284 | /** 285 | * Returns the remote address info for the socket. 286 | * 287 | * The connectedAddress method returns a sockaddr structure wrapped in a NSData object. 288 | * The connectedHost method returns the human readable IP address as a string. 289 | * 290 | * Note: Since UDP is connectionless by design, connected address info 291 | * will not be available unless the socket is explicitly connected to a remote host/port. 292 | * If the socket is not connected, these methods will return nil / 0. 293 | **/ 294 | - (nullable NSData *)connectedAddress; 295 | - (nullable NSString *)connectedHost; 296 | - (uint16_t)connectedPort; 297 | 298 | /** 299 | * Returns whether or not this socket has been connected to a single host. 300 | * By design, UDP is a connectionless protocol, and connecting is not needed. 301 | * If connected, the socket will only be able to send/receive data to/from the connected host. 302 | **/ 303 | - (BOOL)isConnected; 304 | 305 | /** 306 | * Returns whether or not this socket has been closed. 307 | * The only way a socket can be closed is if you explicitly call one of the close methods. 308 | **/ 309 | - (BOOL)isClosed; 310 | 311 | /** 312 | * Returns whether or not this socket is IPv4. 313 | * 314 | * By default this will be true, unless: 315 | * - IPv4 is disabled (via setIPv4Enabled:) 316 | * - The socket is explicitly bound to an IPv6 address 317 | * - The socket is connected to an IPv6 address 318 | **/ 319 | - (BOOL)isIPv4; 320 | 321 | /** 322 | * Returns whether or not this socket is IPv6. 323 | * 324 | * By default this will be true, unless: 325 | * - IPv6 is disabled (via setIPv6Enabled:) 326 | * - The socket is explicitly bound to an IPv4 address 327 | * _ The socket is connected to an IPv4 address 328 | * 329 | * This method will also return false on platforms that do not support IPv6. 330 | * Note: The iPhone does not currently support IPv6. 331 | **/ 332 | - (BOOL)isIPv6; 333 | 334 | #pragma mark Binding 335 | 336 | /** 337 | * Binds the UDP socket to the given port. 338 | * Binding should be done for server sockets that receive data prior to sending it. 339 | * Client sockets can skip binding, 340 | * as the OS will automatically assign the socket an available port when it starts sending data. 341 | * 342 | * You may optionally pass a port number of zero to immediately bind the socket, 343 | * yet still allow the OS to automatically assign an available port. 344 | * 345 | * You cannot bind a socket after its been connected. 346 | * You can only bind a socket once. 347 | * You can still connect a socket (if desired) after binding. 348 | * 349 | * On success, returns YES. 350 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. 351 | **/ 352 | - (BOOL)bindToPort:(uint16_t)port error:(NSError **)errPtr; 353 | 354 | /** 355 | * Binds the UDP socket to the given port and optional interface. 356 | * Binding should be done for server sockets that receive data prior to sending it. 357 | * Client sockets can skip binding, 358 | * as the OS will automatically assign the socket an available port when it starts sending data. 359 | * 360 | * You may optionally pass a port number of zero to immediately bind the socket, 361 | * yet still allow the OS to automatically assign an available port. 362 | * 363 | * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). 364 | * You may also use the special strings "localhost" or "loopback" to specify that 365 | * the socket only accept packets from the local machine. 366 | * 367 | * You cannot bind a socket after its been connected. 368 | * You can only bind a socket once. 369 | * You can still connect a socket (if desired) after binding. 370 | * 371 | * On success, returns YES. 372 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. 373 | **/ 374 | - (BOOL)bindToPort:(uint16_t)port interface:(nullable NSString *)interface error:(NSError **)errPtr; 375 | 376 | /** 377 | * Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. 378 | * 379 | * If you have an existing struct sockaddr you can convert it to a NSData object like so: 380 | * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; 381 | * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; 382 | * 383 | * Binding should be done for server sockets that receive data prior to sending it. 384 | * Client sockets can skip binding, 385 | * as the OS will automatically assign the socket an available port when it starts sending data. 386 | * 387 | * You cannot bind a socket after its been connected. 388 | * You can only bind a socket once. 389 | * You can still connect a socket (if desired) after binding. 390 | * 391 | * On success, returns YES. 392 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. 393 | **/ 394 | - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr; 395 | 396 | #pragma mark Connecting 397 | 398 | /** 399 | * Connects the UDP socket to the given host and port. 400 | * By design, UDP is a connectionless protocol, and connecting is not needed. 401 | * 402 | * Choosing to connect to a specific host/port has the following effect: 403 | * - You will only be able to send data to the connected host/port. 404 | * - You will only be able to receive data from the connected host/port. 405 | * - You will receive ICMP messages that come from the connected host/port, such as "connection refused". 406 | * 407 | * The actual process of connecting a UDP socket does not result in any communication on the socket. 408 | * It simply changes the internal state of the socket. 409 | * 410 | * You cannot bind a socket after it has been connected. 411 | * You can only connect a socket once. 412 | * 413 | * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). 414 | * 415 | * This method is asynchronous as it requires a DNS lookup to resolve the given host name. 416 | * If an obvious error is detected, this method immediately returns NO and sets errPtr. 417 | * If you don't care about the error, you can pass nil for errPtr. 418 | * Otherwise, this method returns YES and begins the asynchronous connection process. 419 | * The result of the asynchronous connection process will be reported via the delegate methods. 420 | **/ 421 | - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; 422 | 423 | /** 424 | * Connects the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. 425 | * 426 | * If you have an existing struct sockaddr you can convert it to a NSData object like so: 427 | * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; 428 | * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; 429 | * 430 | * By design, UDP is a connectionless protocol, and connecting is not needed. 431 | * 432 | * Choosing to connect to a specific address has the following effect: 433 | * - You will only be able to send data to the connected address. 434 | * - You will only be able to receive data from the connected address. 435 | * - You will receive ICMP messages that come from the connected address, such as "connection refused". 436 | * 437 | * Connecting a UDP socket does not result in any communication on the socket. 438 | * It simply changes the internal state of the socket. 439 | * 440 | * You cannot bind a socket after its been connected. 441 | * You can only connect a socket once. 442 | * 443 | * On success, returns YES. 444 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. 445 | * 446 | * Note: Unlike the connectToHost:onPort:error: method, this method does not require a DNS lookup. 447 | * Thus when this method returns, the connection has either failed or fully completed. 448 | * In other words, this method is synchronous, unlike the asynchronous connectToHost::: method. 449 | * However, for compatibility and simplification of delegate code, if this method returns YES 450 | * then the corresponding delegate method (udpSocket:didConnectToHost:port:) is still invoked. 451 | **/ 452 | - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; 453 | 454 | #pragma mark Multicast 455 | 456 | /** 457 | * Join multicast group. 458 | * Group should be an IP address (eg @"225.228.0.1"). 459 | * 460 | * On success, returns YES. 461 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. 462 | **/ 463 | - (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr; 464 | 465 | /** 466 | * Join multicast group. 467 | * Group should be an IP address (eg @"225.228.0.1"). 468 | * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). 469 | * 470 | * On success, returns YES. 471 | * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. 472 | **/ 473 | - (BOOL)joinMulticastGroup:(NSString *)group onInterface:(nullable NSString *)interface error:(NSError **)errPtr; 474 | 475 | - (BOOL)leaveMulticastGroup:(NSString *)group error:(NSError **)errPtr; 476 | - (BOOL)leaveMulticastGroup:(NSString *)group onInterface:(nullable NSString *)interface error:(NSError **)errPtr; 477 | 478 | #pragma mark Reuse Port 479 | 480 | /** 481 | * By default, only one socket can be bound to a given IP address + port at a time. 482 | * To enable multiple processes to simultaneously bind to the same address+port, 483 | * you need to enable this functionality in the socket. All processes that wish to 484 | * use the address+port simultaneously must all enable reuse port on the socket 485 | * bound to that port. 486 | **/ 487 | - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr; 488 | 489 | #pragma mark Broadcast 490 | 491 | /** 492 | * By default, the underlying socket in the OS will not allow you to send broadcast messages. 493 | * In order to send broadcast messages, you need to enable this functionality in the socket. 494 | * 495 | * A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is 496 | * delivered to every host on the network. 497 | * The reason this is generally disabled by default (by the OS) is to prevent 498 | * accidental broadcast messages from flooding the network. 499 | **/ 500 | - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr; 501 | 502 | #pragma mark Sending 503 | 504 | /** 505 | * Asynchronously sends the given data, with the given timeout and tag. 506 | * 507 | * This method may only be used with a connected socket. 508 | * Recall that connecting is optional for a UDP socket. 509 | * For connected sockets, data can only be sent to the connected address. 510 | * For non-connected sockets, the remote destination is specified for each packet. 511 | * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. 512 | * 513 | * @param data 514 | * The data to send. 515 | * If data is nil or zero-length, this method does nothing. 516 | * If passing NSMutableData, please read the thread-safety notice below. 517 | * 518 | * @param timeout 519 | * The timeout for the send opeartion. 520 | * If the timeout value is negative, the send operation will not use a timeout. 521 | * 522 | * @param tag 523 | * The tag is for your convenience. 524 | * It is not sent or received over the socket in any manner what-so-ever. 525 | * It is reported back as a parameter in the udpSocket:didSendDataWithTag: 526 | * or udpSocket:didNotSendDataWithTag:dueToError: methods. 527 | * You can use it as an array index, state id, type constant, etc. 528 | * 529 | * 530 | * Thread-Safety Note: 531 | * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while 532 | * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method 533 | * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying 534 | * that this particular send operation has completed. 535 | * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. 536 | * It simply retains it for performance reasons. 537 | * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. 538 | * Copying this data adds an unwanted/unneeded overhead. 539 | * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket 540 | * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time 541 | * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. 542 | **/ 543 | - (void)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; 544 | 545 | /** 546 | * Asynchronously sends the given data, with the given timeout and tag, to the given host and port. 547 | * 548 | * This method cannot be used with a connected socket. 549 | * Recall that connecting is optional for a UDP socket. 550 | * For connected sockets, data can only be sent to the connected address. 551 | * For non-connected sockets, the remote destination is specified for each packet. 552 | * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. 553 | * 554 | * @param data 555 | * The data to send. 556 | * If data is nil or zero-length, this method does nothing. 557 | * If passing NSMutableData, please read the thread-safety notice below. 558 | * 559 | * @param host 560 | * The destination to send the udp packet to. 561 | * May be specified as a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). 562 | * You may also use the convenience strings of "loopback" or "localhost". 563 | * 564 | * @param port 565 | * The port of the host to send to. 566 | * 567 | * @param timeout 568 | * The timeout for the send opeartion. 569 | * If the timeout value is negative, the send operation will not use a timeout. 570 | * 571 | * @param tag 572 | * The tag is for your convenience. 573 | * It is not sent or received over the socket in any manner what-so-ever. 574 | * It is reported back as a parameter in the udpSocket:didSendDataWithTag: 575 | * or udpSocket:didNotSendDataWithTag:dueToError: methods. 576 | * You can use it as an array index, state id, type constant, etc. 577 | * 578 | * 579 | * Thread-Safety Note: 580 | * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while 581 | * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method 582 | * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying 583 | * that this particular send operation has completed. 584 | * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. 585 | * It simply retains it for performance reasons. 586 | * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. 587 | * Copying this data adds an unwanted/unneeded overhead. 588 | * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket 589 | * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time 590 | * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. 591 | **/ 592 | - (void)sendData:(NSData *)data 593 | toHost:(NSString *)host 594 | port:(uint16_t)port 595 | withTimeout:(NSTimeInterval)timeout 596 | tag:(long)tag; 597 | 598 | /** 599 | * Asynchronously sends the given data, with the given timeout and tag, to the given address. 600 | * 601 | * This method cannot be used with a connected socket. 602 | * Recall that connecting is optional for a UDP socket. 603 | * For connected sockets, data can only be sent to the connected address. 604 | * For non-connected sockets, the remote destination is specified for each packet. 605 | * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. 606 | * 607 | * @param data 608 | * The data to send. 609 | * If data is nil or zero-length, this method does nothing. 610 | * If passing NSMutableData, please read the thread-safety notice below. 611 | * 612 | * @param remoteAddr 613 | * The address to send the data to (specified as a sockaddr structure wrapped in a NSData object). 614 | * 615 | * @param timeout 616 | * The timeout for the send opeartion. 617 | * If the timeout value is negative, the send operation will not use a timeout. 618 | * 619 | * @param tag 620 | * The tag is for your convenience. 621 | * It is not sent or received over the socket in any manner what-so-ever. 622 | * It is reported back as a parameter in the udpSocket:didSendDataWithTag: 623 | * or udpSocket:didNotSendDataWithTag:dueToError: methods. 624 | * You can use it as an array index, state id, type constant, etc. 625 | * 626 | * 627 | * Thread-Safety Note: 628 | * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while 629 | * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method 630 | * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying 631 | * that this particular send operation has completed. 632 | * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. 633 | * It simply retains it for performance reasons. 634 | * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. 635 | * Copying this data adds an unwanted/unneeded overhead. 636 | * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket 637 | * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time 638 | * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. 639 | **/ 640 | - (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag; 641 | 642 | /** 643 | * You may optionally set a send filter for the socket. 644 | * A filter can provide several interesting possibilities: 645 | * 646 | * 1. Optional caching of resolved addresses for domain names. 647 | * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. 648 | * 649 | * 2. Reusable modules of code for bandwidth monitoring. 650 | * 651 | * 3. Sometimes traffic shapers are needed to simulate real world environments. 652 | * A filter allows you to write custom code to simulate such environments. 653 | * The ability to code this yourself is especially helpful when your simulated environment 654 | * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), 655 | * or the system tools to handle this aren't available (e.g. on a mobile device). 656 | * 657 | * For more information about GCDAsyncUdpSocketSendFilterBlock, see the documentation for its typedef. 658 | * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. 659 | * 660 | * Note: This method invokes setSendFilter:withQueue:isAsynchronous: (documented below), 661 | * passing YES for the isAsynchronous parameter. 662 | **/ 663 | - (void)setSendFilter:(nullable GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(nullable dispatch_queue_t)filterQueue; 664 | 665 | /** 666 | * The receive filter can be run via dispatch_async or dispatch_sync. 667 | * Most typical situations call for asynchronous operation. 668 | * 669 | * However, there are a few situations in which synchronous operation is preferred. 670 | * Such is the case when the filter is extremely minimal and fast. 671 | * This is because dispatch_sync is faster than dispatch_async. 672 | * 673 | * If you choose synchronous operation, be aware of possible deadlock conditions. 674 | * Since the socket queue is executing your block via dispatch_sync, 675 | * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. 676 | * For example, you can't query properties on the socket. 677 | **/ 678 | - (void)setSendFilter:(nullable GCDAsyncUdpSocketSendFilterBlock)filterBlock 679 | withQueue:(nullable dispatch_queue_t)filterQueue 680 | isAsynchronous:(BOOL)isAsynchronous; 681 | 682 | #pragma mark Receiving 683 | 684 | /** 685 | * There are two modes of operation for receiving packets: one-at-a-time & continuous. 686 | * 687 | * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. 688 | * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, 689 | * where your state machine may not always be ready to process incoming packets. 690 | * 691 | * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. 692 | * Receiving packets continuously is better suited to real-time streaming applications. 693 | * 694 | * You may switch back and forth between one-at-a-time mode and continuous mode. 695 | * If the socket is currently in continuous mode, calling this method will switch it to one-at-a-time mode. 696 | * 697 | * When a packet is received (and not filtered by the optional receive filter), 698 | * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. 699 | * 700 | * If the socket is able to begin receiving packets, this method returns YES. 701 | * Otherwise it returns NO, and sets the errPtr with appropriate error information. 702 | * 703 | * An example error: 704 | * You created a udp socket to act as a server, and immediately called receive. 705 | * You forgot to first bind the socket to a port number, and received a error with a message like: 706 | * "Must bind socket before you can receive data." 707 | **/ 708 | - (BOOL)receiveOnce:(NSError **)errPtr; 709 | 710 | /** 711 | * There are two modes of operation for receiving packets: one-at-a-time & continuous. 712 | * 713 | * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. 714 | * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, 715 | * where your state machine may not always be ready to process incoming packets. 716 | * 717 | * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. 718 | * Receiving packets continuously is better suited to real-time streaming applications. 719 | * 720 | * You may switch back and forth between one-at-a-time mode and continuous mode. 721 | * If the socket is currently in one-at-a-time mode, calling this method will switch it to continuous mode. 722 | * 723 | * For every received packet (not filtered by the optional receive filter), 724 | * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. 725 | * 726 | * If the socket is able to begin receiving packets, this method returns YES. 727 | * Otherwise it returns NO, and sets the errPtr with appropriate error information. 728 | * 729 | * An example error: 730 | * You created a udp socket to act as a server, and immediately called receive. 731 | * You forgot to first bind the socket to a port number, and received a error with a message like: 732 | * "Must bind socket before you can receive data." 733 | **/ 734 | - (BOOL)beginReceiving:(NSError **)errPtr; 735 | 736 | /** 737 | * If the socket is currently receiving (beginReceiving has been called), this method pauses the receiving. 738 | * That is, it won't read any more packets from the underlying OS socket until beginReceiving is called again. 739 | * 740 | * Important Note: 741 | * GCDAsyncUdpSocket may be running in parallel with your code. 742 | * That is, your delegate is likely running on a separate thread/dispatch_queue. 743 | * When you invoke this method, GCDAsyncUdpSocket may have already dispatched delegate methods to be invoked. 744 | * Thus, if those delegate methods have already been dispatch_async'd, 745 | * your didReceive delegate method may still be invoked after this method has been called. 746 | * You should be aware of this, and program defensively. 747 | **/ 748 | - (void)pauseReceiving; 749 | 750 | /** 751 | * You may optionally set a receive filter for the socket. 752 | * This receive filter may be set to run in its own queue (independent of delegate queue). 753 | * 754 | * A filter can provide several useful features. 755 | * 756 | * 1. Many times udp packets need to be parsed. 757 | * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. 758 | * The end result is a parallel socket io, datagram parsing, and packet processing. 759 | * 760 | * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. 761 | * The filter can prevent such packets from arriving at the delegate. 762 | * And because the filter can run in its own independent queue, this doesn't slow down the delegate. 763 | * 764 | * - Since the udp protocol does not guarantee delivery, udp packets may be lost. 765 | * Many protocols built atop udp thus provide various resend/re-request algorithms. 766 | * This sometimes results in duplicate packets arriving. 767 | * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. 768 | * 769 | * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. 770 | * Such packets need to be ignored. 771 | * 772 | * 3. Sometimes traffic shapers are needed to simulate real world environments. 773 | * A filter allows you to write custom code to simulate such environments. 774 | * The ability to code this yourself is especially helpful when your simulated environment 775 | * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), 776 | * or the system tools to handle this aren't available (e.g. on a mobile device). 777 | * 778 | * Example: 779 | * 780 | * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { 781 | * 782 | * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; 783 | * 784 | * *context = response; 785 | * return (response != nil); 786 | * }; 787 | * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; 788 | * 789 | * For more information about GCDAsyncUdpSocketReceiveFilterBlock, see the documentation for its typedef. 790 | * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. 791 | * 792 | * Note: This method invokes setReceiveFilter:withQueue:isAsynchronous: (documented below), 793 | * passing YES for the isAsynchronous parameter. 794 | **/ 795 | - (void)setReceiveFilter:(nullable GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(nullable dispatch_queue_t)filterQueue; 796 | 797 | /** 798 | * The receive filter can be run via dispatch_async or dispatch_sync. 799 | * Most typical situations call for asynchronous operation. 800 | * 801 | * However, there are a few situations in which synchronous operation is preferred. 802 | * Such is the case when the filter is extremely minimal and fast. 803 | * This is because dispatch_sync is faster than dispatch_async. 804 | * 805 | * If you choose synchronous operation, be aware of possible deadlock conditions. 806 | * Since the socket queue is executing your block via dispatch_sync, 807 | * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. 808 | * For example, you can't query properties on the socket. 809 | **/ 810 | - (void)setReceiveFilter:(nullable GCDAsyncUdpSocketReceiveFilterBlock)filterBlock 811 | withQueue:(nullable dispatch_queue_t)filterQueue 812 | isAsynchronous:(BOOL)isAsynchronous; 813 | 814 | #pragma mark Closing 815 | 816 | /** 817 | * Immediately closes the underlying socket. 818 | * Any pending send operations are discarded. 819 | * 820 | * The GCDAsyncUdpSocket instance may optionally be used again. 821 | * (it will setup/configure/use another unnderlying BSD socket). 822 | **/ 823 | - (void)close; 824 | 825 | /** 826 | * Closes the underlying socket after all pending send operations have been sent. 827 | * 828 | * The GCDAsyncUdpSocket instance may optionally be used again. 829 | * (it will setup/configure/use another unnderlying BSD socket). 830 | **/ 831 | - (void)closeAfterSending; 832 | 833 | #pragma mark Advanced 834 | /** 835 | * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. 836 | * In most cases, the instance creates this queue itself. 837 | * However, to allow for maximum flexibility, the internal queue may be passed in the init method. 838 | * This allows for some advanced options such as controlling socket priority via target queues. 839 | * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. 840 | * 841 | * For example, imagine there are 2 queues: 842 | * dispatch_queue_t socketQueue; 843 | * dispatch_queue_t socketTargetQueue; 844 | * 845 | * If you do this (pseudo-code): 846 | * socketQueue.targetQueue = socketTargetQueue; 847 | * 848 | * Then all socketQueue operations will actually get run on the given socketTargetQueue. 849 | * This is fine and works great in most situations. 850 | * But if you run code directly from within the socketTargetQueue that accesses the socket, 851 | * you could potentially get deadlock. Imagine the following code: 852 | * 853 | * - (BOOL)socketHasSomething 854 | * { 855 | * __block BOOL result = NO; 856 | * dispatch_block_t block = ^{ 857 | * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; 858 | * } 859 | * if (is_executing_on_queue(socketQueue)) 860 | * block(); 861 | * else 862 | * dispatch_sync(socketQueue, block); 863 | * 864 | * return result; 865 | * } 866 | * 867 | * What happens if you call this method from the socketTargetQueue? The result is deadlock. 868 | * This is because the GCD API offers no mechanism to discover a queue's targetQueue. 869 | * Thus we have no idea if our socketQueue is configured with a targetQueue. 870 | * If we had this information, we could easily avoid deadlock. 871 | * But, since these API's are missing or unfeasible, you'll have to explicitly set it. 872 | * 873 | * IF you pass a socketQueue via the init method, 874 | * AND you've configured the passed socketQueue with a targetQueue, 875 | * THEN you should pass the end queue in the target hierarchy. 876 | * 877 | * For example, consider the following queue hierarchy: 878 | * socketQueue -> ipQueue -> moduleQueue 879 | * 880 | * This example demonstrates priority shaping within some server. 881 | * All incoming client connections from the same IP address are executed on the same target queue. 882 | * And all connections for a particular module are executed on the same target queue. 883 | * Thus, the priority of all networking for the entire module can be changed on the fly. 884 | * Additionally, networking traffic from a single IP cannot monopolize the module. 885 | * 886 | * Here's how you would accomplish something like that: 887 | * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock 888 | * { 889 | * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); 890 | * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; 891 | * 892 | * dispatch_set_target_queue(socketQueue, ipQueue); 893 | * dispatch_set_target_queue(iqQueue, moduleQueue); 894 | * 895 | * return socketQueue; 896 | * } 897 | * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket 898 | * { 899 | * [clientConnections addObject:newSocket]; 900 | * [newSocket markSocketQueueTargetQueue:moduleQueue]; 901 | * } 902 | * 903 | * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. 904 | * This is often NOT the case, as such queues are used solely for execution shaping. 905 | **/ 906 | - (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; 907 | - (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; 908 | 909 | /** 910 | * It's not thread-safe to access certain variables from outside the socket's internal queue. 911 | * 912 | * For example, the socket file descriptor. 913 | * File descriptors are simply integers which reference an index in the per-process file table. 914 | * However, when one requests a new file descriptor (by opening a file or socket), 915 | * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. 916 | * So if we're not careful, the following could be possible: 917 | * 918 | * - Thread A invokes a method which returns the socket's file descriptor. 919 | * - The socket is closed via the socket's internal queue on thread B. 920 | * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. 921 | * - Thread A is now accessing/altering the file instead of the socket. 922 | * 923 | * In addition to this, other variables are not actually objects, 924 | * and thus cannot be retained/released or even autoreleased. 925 | * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. 926 | * 927 | * Although there are internal variables that make it difficult to maintain thread-safety, 928 | * it is important to provide access to these variables 929 | * to ensure this class can be used in a wide array of environments. 930 | * This method helps to accomplish this by invoking the current block on the socket's internal queue. 931 | * The methods below can be invoked from within the block to access 932 | * those generally thread-unsafe internal variables in a thread-safe manner. 933 | * The given block will be invoked synchronously on the socket's internal queue. 934 | * 935 | * If you save references to any protected variables and use them outside the block, you do so at your own peril. 936 | **/ 937 | - (void)performBlock:(dispatch_block_t)block; 938 | 939 | /** 940 | * These methods are only available from within the context of a performBlock: invocation. 941 | * See the documentation for the performBlock: method above. 942 | * 943 | * Provides access to the socket's file descriptor(s). 944 | * If the socket isn't connected, or explicity bound to a particular interface, 945 | * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. 946 | **/ 947 | - (int)socketFD; 948 | - (int)socket4FD; 949 | - (int)socket6FD; 950 | 951 | #if TARGET_OS_IPHONE 952 | 953 | /** 954 | * These methods are only available from within the context of a performBlock: invocation. 955 | * See the documentation for the performBlock: method above. 956 | * 957 | * Returns (creating if necessary) a CFReadStream/CFWriteStream for the internal socket. 958 | * 959 | * Generally GCDAsyncUdpSocket doesn't use CFStream. (It uses the faster GCD API's.) 960 | * However, if you need one for any reason, 961 | * these methods are a convenient way to get access to a safe instance of one. 962 | **/ 963 | - (CFReadStreamRef)readStream; 964 | - (CFWriteStreamRef)writeStream; 965 | 966 | /** 967 | * This method is only available from within the context of a performBlock: invocation. 968 | * See the documentation for the performBlock: method above. 969 | * 970 | * Configures the socket to allow it to operate when the iOS application has been backgrounded. 971 | * In other words, this method creates a read & write stream, and invokes: 972 | * 973 | * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); 974 | * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); 975 | * 976 | * Returns YES if successful, NO otherwise. 977 | * 978 | * Example usage: 979 | * 980 | * [asyncUdpSocket performBlock:^{ 981 | * [asyncUdpSocket enableBackgroundingOnSocket]; 982 | * }]; 983 | * 984 | * 985 | * NOTE : Apple doesn't currently support backgrounding UDP sockets. (Only TCP for now). 986 | **/ 987 | //- (BOOL)enableBackgroundingOnSockets; 988 | 989 | #endif 990 | 991 | #pragma mark Utilities 992 | 993 | /** 994 | * Extracting host/port/family information from raw address data. 995 | **/ 996 | 997 | + (nullable NSString *)hostFromAddress:(NSData *)address; 998 | + (uint16_t)portFromAddress:(NSData *)address; 999 | + (int)familyFromAddress:(NSData *)address; 1000 | 1001 | + (BOOL)isIPv4Address:(NSData *)address; 1002 | + (BOOL)isIPv6Address:(NSData *)address; 1003 | 1004 | + (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(uint16_t * __nullable)portPtr fromAddress:(NSData *)address; 1005 | + (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(uint16_t * __nullable)portPtr family:(int * __nullable)afPtr fromAddress:(NSData *)address; 1006 | 1007 | @end 1008 | 1009 | NS_ASSUME_NONNULL_END 1010 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Headers/Private/CocoaAsyncSocket/GCDAsyncSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Headers/Private/CocoaAsyncSocket/GCDAsyncUdpSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Headers/Public/CocoaAsyncSocket/GCDAsyncSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Headers/Public/CocoaAsyncSocket/GCDAsyncUdpSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.5.0): 3 | - CocoaAsyncSocket/GCD (= 7.5.0) 4 | - CocoaAsyncSocket/GCD (7.5.0) 5 | 6 | DEPENDENCIES: 7 | - CocoaAsyncSocket 8 | 9 | SPEC CHECKSUMS: 10 | CocoaAsyncSocket: 3baeb1ddd969f81cf9fca81053ae49ef2d1cbbfa 11 | 12 | PODFILE CHECKSUM: b1e3a866736a9ab7dd4166c491d3b0851e5fdd89 13 | 14 | COCOAPODS: 1.0.1 15 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A071977538C8837BEDEDEECB433837A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CAF4AB1ECD042E4FED766B8370F6530 /* Security.framework */; }; 11 | 27EADC1EFE89FF57C32F56FD57B92D7F /* Pods-CocoaSyncSocket-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 718B9FD223048F0AB6A98BDCDD5151F0 /* Pods-CocoaSyncSocket-dummy.m */; }; 12 | 2E8FCEB4A515997D7968D8760E0AA22B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EABC45C2732A4ED943A7E8ECF24F14F7 /* Foundation.framework */; }; 13 | 35FC1F45C3BADD8F6D490A8A3EDB4B23 /* GCDAsyncSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = A96DAE99D1B5F7E64D6DA08047F0493E /* GCDAsyncSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 3E1764BE19ADA44EE2FAD91D1EB08FF3 /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FA4A6240204725B4889518C38D01C1F /* GCDAsyncSocket.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 15 | 427AFBC251C959B7AF481D0E1C46DD92 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EABC45C2732A4ED943A7E8ECF24F14F7 /* Foundation.framework */; }; 16 | 7898CFB145E8339E5B3B6B5170A0D206 /* CocoaAsyncSocket-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8302960BCF5AEA63670C93066C5648F1 /* CocoaAsyncSocket-dummy.m */; }; 17 | 9B092CB55E19CC1A13B1A6C57C8D939A /* GCDAsyncUdpSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 15846CB1BC3D204F202F175D327476C7 /* GCDAsyncUdpSocket.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 18 | ADA8D8A13C42DD6B615B258F5ED6DF55 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5135EC14FA83C331E94D40C19DAB0764 /* CFNetwork.framework */; }; 19 | C5ED15CB18009FD113D0207E5755FE5E /* GCDAsyncUdpSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C46332AFAEC572EEDE3BE80E6EA8DCE /* GCDAsyncUdpSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 2C8EEDAB14FBAAE4BF07C51C97D409FC /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = B32BCE8088319B63DCD6BA8488784966; 28 | remoteInfo = CocoaAsyncSocket; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 006FA822032896A816A6CFFD44B113BF /* libCocoaAsyncSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCocoaAsyncSocket.a; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 15846CB1BC3D204F202F175D327476C7 /* GCDAsyncUdpSocket.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = GCDAsyncUdpSocket.m; path = Source/GCD/GCDAsyncUdpSocket.m; sourceTree = ""; }; 35 | 18B7C5F718D5254B9CD9EC6C643DC790 /* libPods-CocoaSyncSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CocoaSyncSocket.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 1C46332AFAEC572EEDE3BE80E6EA8DCE /* GCDAsyncUdpSocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = GCDAsyncUdpSocket.h; path = Source/GCD/GCDAsyncUdpSocket.h; sourceTree = ""; }; 37 | 2013983F813E86501248ED4EAC683B02 /* CocoaAsyncSocket.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CocoaAsyncSocket.xcconfig; sourceTree = ""; }; 38 | 210FE742DA51FDC1112A16D88DDC9DB7 /* Pods-CocoaSyncSocket.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CocoaSyncSocket.debug.xcconfig"; sourceTree = ""; }; 39 | 2877AF6AD9FF3FFB59E80D397538326E /* Pods-CocoaSyncSocket-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CocoaSyncSocket-resources.sh"; sourceTree = ""; }; 40 | 5135EC14FA83C331E94D40C19DAB0764 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; 41 | 718B9FD223048F0AB6A98BDCDD5151F0 /* Pods-CocoaSyncSocket-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CocoaSyncSocket-dummy.m"; sourceTree = ""; }; 42 | 7CAF4AB1ECD042E4FED766B8370F6530 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 43 | 7FA4A6240204725B4889518C38D01C1F /* GCDAsyncSocket.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = GCDAsyncSocket.m; path = Source/GCD/GCDAsyncSocket.m; sourceTree = ""; }; 44 | 829581B404760CCA87E0C84542FA2126 /* CocoaAsyncSocket-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CocoaAsyncSocket-prefix.pch"; sourceTree = ""; }; 45 | 8302960BCF5AEA63670C93066C5648F1 /* CocoaAsyncSocket-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CocoaAsyncSocket-dummy.m"; sourceTree = ""; }; 46 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 47 | A96DAE99D1B5F7E64D6DA08047F0493E /* GCDAsyncSocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = GCDAsyncSocket.h; path = Source/GCD/GCDAsyncSocket.h; sourceTree = ""; }; 48 | AA0B6162A1B2EFB6B33022C0A53479EC /* Pods-CocoaSyncSocket-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CocoaSyncSocket-acknowledgements.markdown"; sourceTree = ""; }; 49 | ADAE178E6658B9758D24BB4A84BC5D82 /* Pods-CocoaSyncSocket.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CocoaSyncSocket.release.xcconfig"; sourceTree = ""; }; 50 | B96541E68E68D84B7022B5BDCE813475 /* Pods-CocoaSyncSocket-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CocoaSyncSocket-frameworks.sh"; sourceTree = ""; }; 51 | D12A8ABC45060543FE401CA43F3DFED3 /* Pods-CocoaSyncSocket-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CocoaSyncSocket-acknowledgements.plist"; sourceTree = ""; }; 52 | EABC45C2732A4ED943A7E8ECF24F14F7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 185B9DAEFCBDC91D0070DDFE56F3F9CD /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ADA8D8A13C42DD6B615B258F5ED6DF55 /* CFNetwork.framework in Frameworks */, 61 | 427AFBC251C959B7AF481D0E1C46DD92 /* Foundation.framework in Frameworks */, 62 | 1A071977538C8837BEDEDEECB433837A /* Security.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 909D2B29D9C8CD02707B62CEB0005E2E /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 2E8FCEB4A515997D7968D8760E0AA22B /* Foundation.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 014BA46421156708F0E82006E710BE54 /* GCD */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | A96DAE99D1B5F7E64D6DA08047F0493E /* GCDAsyncSocket.h */, 81 | 7FA4A6240204725B4889518C38D01C1F /* GCDAsyncSocket.m */, 82 | 1C46332AFAEC572EEDE3BE80E6EA8DCE /* GCDAsyncUdpSocket.h */, 83 | 15846CB1BC3D204F202F175D327476C7 /* GCDAsyncUdpSocket.m */, 84 | ); 85 | name = GCD; 86 | sourceTree = ""; 87 | }; 88 | 0D865CCE5A5F1BBA9AAC98BF2D2B2F53 /* Pods-CocoaSyncSocket */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | AA0B6162A1B2EFB6B33022C0A53479EC /* Pods-CocoaSyncSocket-acknowledgements.markdown */, 92 | D12A8ABC45060543FE401CA43F3DFED3 /* Pods-CocoaSyncSocket-acknowledgements.plist */, 93 | 718B9FD223048F0AB6A98BDCDD5151F0 /* Pods-CocoaSyncSocket-dummy.m */, 94 | B96541E68E68D84B7022B5BDCE813475 /* Pods-CocoaSyncSocket-frameworks.sh */, 95 | 2877AF6AD9FF3FFB59E80D397538326E /* Pods-CocoaSyncSocket-resources.sh */, 96 | 210FE742DA51FDC1112A16D88DDC9DB7 /* Pods-CocoaSyncSocket.debug.xcconfig */, 97 | ADAE178E6658B9758D24BB4A84BC5D82 /* Pods-CocoaSyncSocket.release.xcconfig */, 98 | ); 99 | name = "Pods-CocoaSyncSocket"; 100 | path = "Target Support Files/Pods-CocoaSyncSocket"; 101 | sourceTree = ""; 102 | }; 103 | 1178F420F04662BB9B205EF659BBA2AB /* iOS */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 5135EC14FA83C331E94D40C19DAB0764 /* CFNetwork.framework */, 107 | EABC45C2732A4ED943A7E8ECF24F14F7 /* Foundation.framework */, 108 | 7CAF4AB1ECD042E4FED766B8370F6530 /* Security.framework */, 109 | ); 110 | name = iOS; 111 | sourceTree = ""; 112 | }; 113 | 122DA2E5084A4393C29BE363C764795C /* Frameworks */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 1178F420F04662BB9B205EF659BBA2AB /* iOS */, 117 | ); 118 | name = Frameworks; 119 | sourceTree = ""; 120 | }; 121 | 23555E6BD417C408867089978B7C5855 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 006FA822032896A816A6CFFD44B113BF /* libCocoaAsyncSocket.a */, 125 | 18B7C5F718D5254B9CD9EC6C643DC790 /* libPods-CocoaSyncSocket.a */, 126 | ); 127 | name = Products; 128 | sourceTree = ""; 129 | }; 130 | 3750E20CAB4987ACB8AB27B6C25C1D60 /* Pods */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | C08BDAE7F82E524B481D86E252AF4E44 /* CocoaAsyncSocket */, 134 | ); 135 | name = Pods; 136 | sourceTree = ""; 137 | }; 138 | 7DB346D0F39D3F0E887471402A8071AB = { 139 | isa = PBXGroup; 140 | children = ( 141 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 142 | 122DA2E5084A4393C29BE363C764795C /* Frameworks */, 143 | 3750E20CAB4987ACB8AB27B6C25C1D60 /* Pods */, 144 | 23555E6BD417C408867089978B7C5855 /* Products */, 145 | 7FECBA575B075E153692937A6C9AA2E0 /* Targets Support Files */, 146 | ); 147 | sourceTree = ""; 148 | }; 149 | 7FECBA575B075E153692937A6C9AA2E0 /* Targets Support Files */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 0D865CCE5A5F1BBA9AAC98BF2D2B2F53 /* Pods-CocoaSyncSocket */, 153 | ); 154 | name = "Targets Support Files"; 155 | sourceTree = ""; 156 | }; 157 | B132CF6293DAB8BE702C89EE49087DAB /* Support Files */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | 2013983F813E86501248ED4EAC683B02 /* CocoaAsyncSocket.xcconfig */, 161 | 8302960BCF5AEA63670C93066C5648F1 /* CocoaAsyncSocket-dummy.m */, 162 | 829581B404760CCA87E0C84542FA2126 /* CocoaAsyncSocket-prefix.pch */, 163 | ); 164 | name = "Support Files"; 165 | path = "../Target Support Files/CocoaAsyncSocket"; 166 | sourceTree = ""; 167 | }; 168 | C08BDAE7F82E524B481D86E252AF4E44 /* CocoaAsyncSocket */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 014BA46421156708F0E82006E710BE54 /* GCD */, 172 | B132CF6293DAB8BE702C89EE49087DAB /* Support Files */, 173 | ); 174 | path = CocoaAsyncSocket; 175 | sourceTree = ""; 176 | }; 177 | /* End PBXGroup section */ 178 | 179 | /* Begin PBXHeadersBuildPhase section */ 180 | 53ECEA9F0F6B9D855D2B524015EE3803 /* Headers */ = { 181 | isa = PBXHeadersBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 35FC1F45C3BADD8F6D490A8A3EDB4B23 /* GCDAsyncSocket.h in Headers */, 185 | C5ED15CB18009FD113D0207E5755FE5E /* GCDAsyncUdpSocket.h in Headers */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXHeadersBuildPhase section */ 190 | 191 | /* Begin PBXNativeTarget section */ 192 | B32BCE8088319B63DCD6BA8488784966 /* CocoaAsyncSocket */ = { 193 | isa = PBXNativeTarget; 194 | buildConfigurationList = E64B6805CE139CFAF343151BC84562AD /* Build configuration list for PBXNativeTarget "CocoaAsyncSocket" */; 195 | buildPhases = ( 196 | 27BD9F087014CA34AF9518D02307329B /* Sources */, 197 | 185B9DAEFCBDC91D0070DDFE56F3F9CD /* Frameworks */, 198 | 53ECEA9F0F6B9D855D2B524015EE3803 /* Headers */, 199 | ); 200 | buildRules = ( 201 | ); 202 | dependencies = ( 203 | ); 204 | name = CocoaAsyncSocket; 205 | productName = CocoaAsyncSocket; 206 | productReference = 006FA822032896A816A6CFFD44B113BF /* libCocoaAsyncSocket.a */; 207 | productType = "com.apple.product-type.library.static"; 208 | }; 209 | D65D02372E124B6829D745AAD9376297 /* Pods-CocoaSyncSocket */ = { 210 | isa = PBXNativeTarget; 211 | buildConfigurationList = 3D9448E3181DF47870C52AFA77E5FED6 /* Build configuration list for PBXNativeTarget "Pods-CocoaSyncSocket" */; 212 | buildPhases = ( 213 | 0488E876BC6C87EAE952439F24DAB24B /* Sources */, 214 | 909D2B29D9C8CD02707B62CEB0005E2E /* Frameworks */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | 5BF8408C654B0C7722D13A56A3606EBC /* PBXTargetDependency */, 220 | ); 221 | name = "Pods-CocoaSyncSocket"; 222 | productName = "Pods-CocoaSyncSocket"; 223 | productReference = 18B7C5F718D5254B9CD9EC6C643DC790 /* libPods-CocoaSyncSocket.a */; 224 | productType = "com.apple.product-type.library.static"; 225 | }; 226 | /* End PBXNativeTarget section */ 227 | 228 | /* Begin PBXProject section */ 229 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 230 | isa = PBXProject; 231 | attributes = { 232 | LastSwiftUpdateCheck = 0730; 233 | LastUpgradeCheck = 0700; 234 | }; 235 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 236 | compatibilityVersion = "Xcode 3.2"; 237 | developmentRegion = English; 238 | hasScannedForEncodings = 0; 239 | knownRegions = ( 240 | en, 241 | ); 242 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 243 | productRefGroup = 23555E6BD417C408867089978B7C5855 /* Products */; 244 | projectDirPath = ""; 245 | projectRoot = ""; 246 | targets = ( 247 | B32BCE8088319B63DCD6BA8488784966 /* CocoaAsyncSocket */, 248 | D65D02372E124B6829D745AAD9376297 /* Pods-CocoaSyncSocket */, 249 | ); 250 | }; 251 | /* End PBXProject section */ 252 | 253 | /* Begin PBXSourcesBuildPhase section */ 254 | 0488E876BC6C87EAE952439F24DAB24B /* Sources */ = { 255 | isa = PBXSourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | 27EADC1EFE89FF57C32F56FD57B92D7F /* Pods-CocoaSyncSocket-dummy.m in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | 27BD9F087014CA34AF9518D02307329B /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 7898CFB145E8339E5B3B6B5170A0D206 /* CocoaAsyncSocket-dummy.m in Sources */, 267 | 3E1764BE19ADA44EE2FAD91D1EB08FF3 /* GCDAsyncSocket.m in Sources */, 268 | 9B092CB55E19CC1A13B1A6C57C8D939A /* GCDAsyncUdpSocket.m in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXSourcesBuildPhase section */ 273 | 274 | /* Begin PBXTargetDependency section */ 275 | 5BF8408C654B0C7722D13A56A3606EBC /* PBXTargetDependency */ = { 276 | isa = PBXTargetDependency; 277 | name = CocoaAsyncSocket; 278 | target = B32BCE8088319B63DCD6BA8488784966 /* CocoaAsyncSocket */; 279 | targetProxy = 2C8EEDAB14FBAAE4BF07C51C97D409FC /* PBXContainerItemProxy */; 280 | }; 281 | /* End PBXTargetDependency section */ 282 | 283 | /* Begin XCBuildConfiguration section */ 284 | 0E48CA97A402FC29A828EC690DCF75E5 /* Release */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = ADAE178E6658B9758D24BB4A84BC5D82 /* Pods-CocoaSyncSocket.release.xcconfig */; 287 | buildSettings = { 288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_STRICT_OBJC_MSGSEND = YES; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 293 | MACH_O_TYPE = staticlib; 294 | MTL_ENABLE_DEBUG_INFO = NO; 295 | OTHER_LDFLAGS = ""; 296 | OTHER_LIBTOOLFLAGS = ""; 297 | PODS_ROOT = "$(SRCROOT)"; 298 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SDKROOT = iphoneos; 301 | SKIP_INSTALL = YES; 302 | }; 303 | name = Release; 304 | }; 305 | 3950903405596EF0602E649BF7271741 /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 2013983F813E86501248ED4EAC683B02 /* CocoaAsyncSocket.xcconfig */; 308 | buildSettings = { 309 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 310 | DEBUG_INFORMATION_FORMAT = dwarf; 311 | ENABLE_STRICT_OBJC_MSGSEND = YES; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_PREFIX_HEADER = "Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-prefix.pch"; 314 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 315 | MTL_ENABLE_DEBUG_INFO = YES; 316 | OTHER_LDFLAGS = ""; 317 | OTHER_LIBTOOLFLAGS = ""; 318 | PRIVATE_HEADERS_FOLDER_PATH = ""; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | PUBLIC_HEADERS_FOLDER_PATH = ""; 321 | SDKROOT = iphoneos; 322 | SKIP_INSTALL = YES; 323 | }; 324 | name = Debug; 325 | }; 326 | 3FA2475660FFC880302AD18E29B2E5FC /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_ANALYZER_NONNULL = YES; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 338 | CLANG_WARN_EMPTY_BODY = YES; 339 | CLANG_WARN_ENUM_CONVERSION = YES; 340 | CLANG_WARN_INT_CONVERSION = YES; 341 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | COPY_PHASE_STRIP = NO; 345 | ENABLE_TESTABILITY = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_DYNAMIC_NO_PIC = NO; 348 | GCC_OPTIMIZATION_LEVEL = 0; 349 | GCC_PREPROCESSOR_DEFINITIONS = ( 350 | "POD_CONFIGURATION_DEBUG=1", 351 | "DEBUG=1", 352 | "$(inherited)", 353 | ); 354 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 362 | ONLY_ACTIVE_ARCH = YES; 363 | STRIP_INSTALLED_PRODUCT = NO; 364 | SYMROOT = "${SRCROOT}/../build"; 365 | }; 366 | name = Debug; 367 | }; 368 | 659B7D764E38E106385C1CE47DF08BD3 /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = 2013983F813E86501248ED4EAC683B02 /* CocoaAsyncSocket.xcconfig */; 371 | buildSettings = { 372 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 373 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_PREFIX_HEADER = "Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-prefix.pch"; 377 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 378 | MTL_ENABLE_DEBUG_INFO = NO; 379 | OTHER_LDFLAGS = ""; 380 | OTHER_LIBTOOLFLAGS = ""; 381 | PRIVATE_HEADERS_FOLDER_PATH = ""; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | PUBLIC_HEADERS_FOLDER_PATH = ""; 384 | SDKROOT = iphoneos; 385 | SKIP_INSTALL = YES; 386 | }; 387 | name = Release; 388 | }; 389 | 7001939453962CD03EB7CC2F39DE58A1 /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | baseConfigurationReference = 210FE742DA51FDC1112A16D88DDC9DB7 /* Pods-CocoaSyncSocket.debug.xcconfig */; 392 | buildSettings = { 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | DEBUG_INFORMATION_FORMAT = dwarf; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 398 | MACH_O_TYPE = staticlib; 399 | MTL_ENABLE_DEBUG_INFO = YES; 400 | OTHER_LDFLAGS = ""; 401 | OTHER_LIBTOOLFLAGS = ""; 402 | PODS_ROOT = "$(SRCROOT)"; 403 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | SDKROOT = iphoneos; 406 | SKIP_INSTALL = YES; 407 | }; 408 | name = Debug; 409 | }; 410 | F325026B55060D3B22BEC0BAB5FA7344 /* Release */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ALWAYS_SEARCH_USER_PATHS = NO; 414 | CLANG_ANALYZER_NONNULL = YES; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_MODULES = YES; 418 | CLANG_ENABLE_OBJC_ARC = YES; 419 | CLANG_WARN_BOOL_CONVERSION = YES; 420 | CLANG_WARN_CONSTANT_CONVERSION = YES; 421 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 422 | CLANG_WARN_EMPTY_BODY = YES; 423 | CLANG_WARN_ENUM_CONVERSION = YES; 424 | CLANG_WARN_INT_CONVERSION = YES; 425 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 426 | CLANG_WARN_UNREACHABLE_CODE = YES; 427 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 428 | COPY_PHASE_STRIP = YES; 429 | ENABLE_NS_ASSERTIONS = NO; 430 | GCC_C_LANGUAGE_STANDARD = gnu99; 431 | GCC_PREPROCESSOR_DEFINITIONS = ( 432 | "POD_CONFIGURATION_RELEASE=1", 433 | "$(inherited)", 434 | ); 435 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 436 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 437 | GCC_WARN_UNDECLARED_SELECTOR = YES; 438 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 439 | GCC_WARN_UNUSED_FUNCTION = YES; 440 | GCC_WARN_UNUSED_VARIABLE = YES; 441 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 442 | STRIP_INSTALLED_PRODUCT = NO; 443 | SYMROOT = "${SRCROOT}/../build"; 444 | VALIDATE_PRODUCT = YES; 445 | }; 446 | name = Release; 447 | }; 448 | /* End XCBuildConfiguration section */ 449 | 450 | /* Begin XCConfigurationList section */ 451 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | 3FA2475660FFC880302AD18E29B2E5FC /* Debug */, 455 | F325026B55060D3B22BEC0BAB5FA7344 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | 3D9448E3181DF47870C52AFA77E5FED6 /* Build configuration list for PBXNativeTarget "Pods-CocoaSyncSocket" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 7001939453962CD03EB7CC2F39DE58A1 /* Debug */, 464 | 0E48CA97A402FC29A828EC690DCF75E5 /* Release */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | E64B6805CE139CFAF343151BC84562AD /* Build configuration list for PBXNativeTarget "CocoaAsyncSocket" */ = { 470 | isa = XCConfigurationList; 471 | buildConfigurations = ( 472 | 3950903405596EF0602E649BF7271741 /* Debug */, 473 | 659B7D764E38E106385C1CE47DF08BD3 /* Release */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | }; 480 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 481 | } 482 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Pods.xcodeproj/xcuserdata/tuyaohui.xcuserdatad/xcschemes/CocoaAsyncSocket.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Pods.xcodeproj/xcuserdata/tuyaohui.xcuserdatad/xcschemes/Pods-CocoaSyncSocket.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Pods.xcodeproj/xcuserdata/tuyaohui.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CocoaAsyncSocket.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods-CocoaSyncSocket.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | B32BCE8088319B63DCD6BA8488784966 21 | 22 | primary 23 | 24 | 25 | D65D02372E124B6829D745AAD9376297 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CocoaAsyncSocket : NSObject 3 | @end 4 | @implementation PodsDummy_CocoaAsyncSocket 5 | @end 6 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/CocoaAsyncSocket 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 4 | OTHER_LDFLAGS = -framework "CFNetwork" -framework "Security" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## CocoaAsyncSocket 5 | 6 | Public Domain License 7 | 8 | The CocoaAsyncSocket project is in the public domain. 9 | 10 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 11 | Updated and maintained by Deusty LLC and the Apple development community. 12 | 13 | Generated by CocoaPods - https://cocoapods.org 14 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Public Domain License 18 | 19 | The CocoaAsyncSocket project is in the public domain. 20 | 21 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 22 | Updated and maintained by Deusty LLC and the Apple development community. 23 | 24 | Title 25 | CocoaAsyncSocket 26 | Type 27 | PSGroupSpecifier 28 | 29 | 30 | FooterText 31 | Generated by CocoaPods - https://cocoapods.org 32 | Title 33 | 34 | Type 35 | PSGroupSpecifier 36 | 37 | 38 | StringsTable 39 | Acknowledgements 40 | Title 41 | Acknowledgements 42 | 43 | 44 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CocoaSyncSocket : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CocoaSyncSocket 5 | @end 6 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | *) 22 | TARGET_DEVICE_ARGS="--target-device mac" 23 | ;; 24 | esac 25 | 26 | realpath() { 27 | DIRECTORY="$(cd "${1%/*}" && pwd)" 28 | FILENAME="${1##*/}" 29 | echo "$DIRECTORY/$FILENAME" 30 | } 31 | 32 | install_resource() 33 | { 34 | if [[ "$1" = /* ]] ; then 35 | RESOURCE_PATH="$1" 36 | else 37 | RESOURCE_PATH="${PODS_ROOT}/$1" 38 | fi 39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 40 | cat << EOM 41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 42 | EOM 43 | exit 1 44 | fi 45 | case $RESOURCE_PATH in 46 | *.storyboard) 47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 49 | ;; 50 | *.xib) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.framework) 55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 59 | ;; 60 | *.xcdatamodel) 61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 63 | ;; 64 | *.xcdatamodeld) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 67 | ;; 68 | *.xcmappingmodel) 69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 71 | ;; 72 | *.xcassets) 73 | ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") 74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 75 | ;; 76 | *) 77 | echo "$RESOURCE_PATH" 78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 79 | ;; 80 | esac 81 | } 82 | 83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | fi 89 | rm -f "$RESOURCES_TO_COPY" 90 | 91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 92 | then 93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 95 | while read line; do 96 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 97 | XCASSET_FILES+=("$line") 98 | fi 99 | done <<<"$OTHER_XCASSETS" 100 | 101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 102 | fi 103 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -framework "CFNetwork" -framework "Security" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /CocoaSyncSocket/Pods/Target Support Files/Pods-CocoaSyncSocket/Pods-CocoaSyncSocket.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaAsyncSocket" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -framework "CFNetwork" -framework "Security" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /CocoaSyncSocket/podfile: -------------------------------------------------------------------------------- 1 | platform :ios,"7.0" 2 | 3 | target "CocoaSyncSocket" do 4 | pod 'CocoaAsyncSocket' 5 | 6 | end 7 | --------------------------------------------------------------------------------