Compare commits

..

42 Commits

Author SHA1 Message Date
运筹
4a3af2cbba
Merge pull request #179 from odariusgeorge/patch-1
update swift version
2020-01-27 22:05:37 +08:00
运筹
24ee358a41
Merge branch 'master' into patch-1 2020-01-27 22:05:21 +08:00
运筹
8b09fa2e87
Merge pull request #186 from eschos24/swift_5
Update to Swift 5
2020-01-06 23:24:14 +08:00
Eric Schofield
55d85b7119 Fixed a spelling error in SwiftSocket.podspec 2019-11-29 19:06:27 -07:00
Eric Schofield
97d64be723 Use 'let' instead of 'var' to satisfy a warning 2019-11-29 19:05:36 -07:00
Eric Schofield
24cc9bf118 Updated to Swift 5 in podspec 2019-11-29 19:04:50 -07:00
odariusgeorge
fadd0e198d
update swift version
Xcode 10.2 - carthage - unsupported swift version (3.0 not supported anymore)
2019-08-20 15:21:42 +03:00
运筹
2e6ba27140
Merge pull request #169 from Thomas06000/master
Migrate to Swift 5
2019-07-24 21:18:32 +08:00
运筹
cb0af50dbb
Merge pull request #150 from keab42/bugfix/fix-sigpipe-13-error
Disabling SIGPIPE errors on UDP Client.
2019-07-24 21:15:26 +08:00
Thomas06000
e6c6c4d760
remove useless space 2019-04-24 11:50:57 +02:00
Thomas Auger
c1a7ac522a migrate to swift 5, update AppDelegate 2019-04-15 15:08:01 +02:00
Thomas Auger
8f7d7cb144 migrate to swift 5 2019-04-15 15:04:23 +02:00
Thomas Auger
e8bf27c467 migrate localization 2019-04-15 15:00:47 +02:00
May Keable
ee34b7a68d Disabling SIGPIPE errors on UDP Client. 2018-08-07 15:07:47 +01:00
运筹
7cd6d8e846
Merge pull request #137 from willson556/master
Add bytesAvailable() method.
2018-06-25 10:13:29 +08:00
运筹
ab16278795 Merge pull request #117 from varunpm1/master
Set Swift 3 Obj reference warning state to default to remove compiler…
2017-10-02 08:02:27 -05:00
Varun P M
31f6a91532 Set Swift 3 Obj reference warning state to default to remove compiler warning 2017-09-25 19:07:37 +05:30
运筹
f5dd443dba Merge pull request #114 from varunpm1/master
Updated project settings to Swift 4
2017-09-23 00:13:23 +08:00
运筹
fd274a888d Merge pull request #115 from jhihguan/fix-printf
remove print read data
2017-09-23 00:12:19 +08:00
Wane Wang
ecfe786014 remove print read data 2017-09-20 01:58:31 -05:00
Varun P M
0c5e36bee8 Updated project settings to Swift 4 2017-09-19 12:24:36 +05:30
Dan Shevlyuk
5682b6dd19 Release 2.0.2 2017-07-28 18:20:08 +03:00
运筹
73c625d1b6 Merge pull request #95 from tomthecarrot/master
Add C code include for Swift 4
2017-07-21 23:10:44 -05:00
运筹
c421fa4208 Merge pull request #96 from ivlevAstef/master
fix ytcpsocket_pull return value. Now it returns how much was transferred
2017-07-21 23:10:06 -05:00
Thomas Suarez
02eb90b188 Add C code include for Swift 4 2017-07-16 23:16:37 -07:00
Ivlev Alexander
cceb04abde fix ytcpsocket_pull return value. Now it returns how much was transferred. 2017-07-17 11:09:03 +07:00
运筹
3131c58dfd Merge pull request #81 from Larrycal/master
Use loop to make sure recevie all data
2017-06-05 13:56:09 +08:00
柳钰柯
e0a55fea0e set no delay 2017-05-08 15:59:10 +08:00
柳钰柯
bbd4f2ddfe Use loop to make sure receive all data by using read() 2017-05-08 15:53:17 +08:00
柳钰柯
fa1d5a6a2f use recv() to receive data instead of read() 2017-05-08 15:18:21 +08:00
运筹
46a9ea6746 Merge pull request #77 from drdator/master
Fix UDP server binding
2017-04-11 13:20:19 +08:00
Einar Andersson
8eadfcd0f0 Fix UDP server binding 2017-04-10 21:08:51 +02:00
Dan
bcc2f3037e Merge pull request #75 from schnippi/fix-appleTvTarget
Fix Apple Tv target Device family
2017-04-05 09:28:58 +03:00
Stefan M. Schneider
e488b284d3 Fix Apple Tv target Device family
TARGET_DEVICE_FAMILY for appleTV is 3 and not 1,2 (iPhone, iPad) This
change is needed to have the build of appleTV target against appleTV
simulator succeed. Without this change build of apple tv target fails
for Carthage appleTV simulator build
2017-04-04 21:41:46 +02:00
运筹
d706258d94 Merge pull request #72 from SolitaryCipher/master
Add optional timeout on TCPServer accept()
2017-03-23 14:46:40 +08:00
Nick
23a4b42d4c Add optional timeout on TCPServer accept() 2017-03-14 14:03:23 -04:00
运筹
8032a0fc99 Merge pull request #59 from HubertZhang/master
Add recv for UDP Client
2017-02-08 10:39:26 +08:00
Dan
a1eb0a5ac0 Merge pull request #64 from alxstu/patch-1
changed wrong variable names
2017-01-28 13:54:29 +03:00
alxstu
31aa522e9b changed wrong variable names
"c" has to be "client"
2017-01-28 00:35:54 +01:00
Hubertzhang
c3e897d571 improve code quality in UDPClient.recv 2017-01-17 17:54:53 +08:00
Hubert Zhang
7295b73f62 Add recv for UDP Client
Allow UDP Client receive response
2017-01-14 16:02:05 +08:00
Thomas Willson
8f5cd72575 Add method to get bytes available for reading. 2016-12-19 14:15:09 +00:00
14 changed files with 247 additions and 218 deletions

View File

@ -78,10 +78,10 @@ switch client.connect(timeout: 1) {
## Server socket example (echo server)
``` swift
func echoService(client: TCPClient) {
print("Newclient from:\(c.address)[\(c.port)]")
var d = c.read(1024*10)
c.send(data: d!)
c.close()
print("Newclient from:\(client.address)[\(client.port)]")
var d = client.read(1024*10)
client.send(data: d!)
client.close()
}
func testServer() {

View File

@ -32,11 +32,14 @@ import Foundation
@_silgen_name("ytcpsocket_connect") private func c_ytcpsocket_connect(_ host:UnsafePointer<Byte>,port:Int32,timeout:Int32) -> Int32
@_silgen_name("ytcpsocket_close") private func c_ytcpsocket_close(_ fd:Int32) -> Int32
@_silgen_name("ytcpsocket_bytes_available") private func c_ytcpsocket_bytes_available(_ fd:Int32) -> Int32
@_silgen_name("ytcpsocket_send") private func c_ytcpsocket_send(_ fd:Int32,buff:UnsafePointer<Byte>,len:Int32) -> Int32
@_silgen_name("ytcpsocket_pull") private func c_ytcpsocket_pull(_ fd:Int32,buff:UnsafePointer<Byte>,len:Int32,timeout:Int32) -> Int32
@_silgen_name("ytcpsocket_listen") private func c_ytcpsocket_listen(_ address:UnsafePointer<Int8>,port:Int32)->Int32
@_silgen_name("ytcpsocket_accept") private func c_ytcpsocket_accept(_ onsocketfd:Int32,ip:UnsafePointer<Int8>,port:UnsafePointer<Int32>,timeout:Int32) -> Int32
@_silgen_name("ytcpsocket_port") private func c_ytcpsocket_port(_ fd:Int32) -> Int32
open class TCPClient: Socket {
/*
* connect to server
* return success or fail with message
@ -59,7 +62,7 @@ open class TCPClient: Socket {
}
}
}
/*
* close socket
* return success or fail with message
@ -133,4 +136,66 @@ open class TCPClient: Socket {
return data
}
/*
* gets byte available for reading
*/
open func bytesAvailable() -> Int32? {
guard let fd:Int32 = self.fd else { return nil }
let bytesAvailable = c_ytcpsocket_bytes_available(fd);
if (bytesAvailable < 0) {
return nil
}
return bytesAvailable
}
}
open class TCPServer: Socket {
open func listen() -> Result {
let fd = c_ytcpsocket_listen(self.address, port: Int32(self.port))
if fd > 0 {
self.fd = fd
// If port 0 is used, get the actual port number which the server is listening to
if (self.port == 0) {
let p = c_ytcpsocket_port(fd)
if (p == -1) {
return .failure(SocketError.unknownError)
} else {
self.port = p
}
}
return .success
} else {
return .failure(SocketError.unknownError)
}
}
open func accept(timeout :Int32 = 0) -> TCPClient? {
guard let serferfd = self.fd else { return nil }
var buff: [Int8] = [Int8](repeating: 0x0,count: 16)
var port: Int32 = 0
let clientfd: Int32 = c_ytcpsocket_accept(serferfd, ip: &buff, port: &port, timeout: timeout)
guard clientfd >= 0 else { return nil }
guard let address = String(cString: buff, encoding: String.Encoding.utf8) else { return nil }
let client = TCPClient(address: address, port: port)
client.fd = clientfd
return client
}
open func close() {
guard let fd: Int32=self.fd else { return }
_ = c_ytcpsocket_close(fd)
self.fd = nil
}
}

View File

@ -1,83 +0,0 @@
//
// Copyright (c) <2014>, skysent
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// This product includes software developed by skysent.
// 4. Neither the name of the skysent nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY skysent ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL skysent BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
import Foundation
@_silgen_name("ytcpsocket_listen") private func c_ytcpsocket_listen(_ address:UnsafePointer<Int8>,port:Int32)->Int32
@_silgen_name("ytcpsocket_accept") private func c_ytcpsocket_accept(_ onsocketfd:Int32,ip:UnsafePointer<Int8>,port:UnsafePointer<Int32>) -> Int32
@_silgen_name("ytcpsocket_port") private func c_ytcpsocket_port(_ fd:Int32) -> Int32
@_silgen_name("ytcpsocket_close") private func c_ytcpsocket_close(_ fd:Int32) -> Int32
open class TCPServer: Socket {
open func listen() -> Result {
let fd = c_ytcpsocket_listen(self.address, port: Int32(self.port))
if fd > 0 {
self.fd = fd
// If port 0 is used, get the actual port number which the server is listening to
if (self.port == 0) {
let p = c_ytcpsocket_port(fd)
if (p == -1) {
return .failure(SocketError.unknownError)
} else {
self.port = p
}
}
return .success
} else {
return .failure(SocketError.unknownError)
}
}
open func accept() -> TCPClient? {
guard let serferfd = self.fd else { return nil }
var buff: [Int8] = [Int8](repeating: 0x0,count: 16)
var port: Int32 = 0
let clientfd: Int32 = c_ytcpsocket_accept(serferfd, ip: &buff, port: &port)
guard clientfd >= 0 else { return nil }
guard let address = String(cString: buff, encoding: String.Encoding.utf8) else { return nil }
let client = TCPClient(address: address, port: port)
client.fd = clientfd
return client
}
open func close() {
guard let fd: Int32=self.fd else { return }
_ = c_ytcpsocket_close(fd)
self.fd = nil
}
}

View File

@ -30,6 +30,8 @@
import Foundation
@_silgen_name("yudpsocket_server") func c_yudpsocket_server(_ host:UnsafePointer<Int8>,port:Int32) -> Int32
@_silgen_name("yudpsocket_recive") func c_yudpsocket_recive(_ fd:Int32,buff:UnsafePointer<Byte>,len:Int32,ip:UnsafePointer<Int8>,port:UnsafePointer<Int32>) -> Int32
@_silgen_name("yudpsocket_close") func c_yudpsocket_close(_ fd:Int32) -> Int32
@_silgen_name("yudpsocket_client") func c_yudpsocket_client() -> Int32
@_silgen_name("yudpsocket_get_server_ip") func c_yudpsocket_get_server_ip(_ host:UnsafePointer<Int8>,ip:UnsafePointer<Int8>) -> Int32
@ -109,6 +111,26 @@ open class UDPClient: Socket {
}
}
//TODO add multycast and boardcast
open func recv(_ expectlen: Int) -> ([Byte]?, String, Int) {
guard let fd = self.fd else {
return (nil, "no ip", 0)
}
let buff: [Byte] = [Byte](repeating: 0x0, count: expectlen)
var remoteipbuff: [Int8] = [Int8](repeating: 0x0, count: 16)
var remoteport: Int32 = 0
let readLen: Int32 = c_yudpsocket_recive(fd, buff: buff, len: Int32(expectlen), ip: &remoteipbuff, port: &remoteport)
let port: Int = Int(remoteport)
let address = String(cString: remoteipbuff, encoding: String.Encoding.utf8) ?? ""
if readLen <= 0 {
return (nil, address, port)
}
let data: [Byte] = Array(buff[0..<Int(readLen)])
return (data, address, port)
}
open func close() {
guard let fd = self.fd else { return }
@ -117,3 +139,47 @@ open class UDPClient: Socket {
}
//TODO add multycast and boardcast
}
open class UDPServer: Socket {
public override init(address: String, port: Int32) {
super.init(address: address, port: port)
let fd = c_yudpsocket_server(address, port: port)
if fd > 0 {
self.fd = fd
}
}
//TODO add multycast and boardcast
open func recv(_ expectlen: Int) -> ([Byte]?, String, Int) {
if let fd = self.fd {
let buff: [Byte] = [Byte](repeating: 0x0,count: expectlen)
var remoteipbuff: [Int8] = [Int8](repeating: 0x0,count: 16)
var remoteport: Int32 = 0
let readLen: Int32 = c_yudpsocket_recive(fd, buff: buff, len: Int32(expectlen), ip: &remoteipbuff, port: &remoteport)
let port: Int = Int(remoteport)
var address = ""
if let ip = String(cString: remoteipbuff, encoding: String.Encoding.utf8) {
address = ip
}
if readLen <= 0 {
return (nil, address, port)
}
let rs = buff[0...Int(readLen-1)]
let data: [Byte] = Array(rs)
return (data, address, port)
}
return (nil, "no ip", 0)
}
open func close() {
guard let fd = self.fd else { return }
_ = c_yudpsocket_close(fd)
self.fd = nil
}
}

View File

@ -1,78 +0,0 @@
//
// Copyright (c) <2014>, skysent
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// This product includes software developed by skysent.
// 4. Neither the name of the skysent nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY skysent ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL skysent BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
import Foundation
@_silgen_name("yudpsocket_server") func c_yudpsocket_server(_ host:UnsafePointer<Int8>,port:Int32) -> Int32
@_silgen_name("yudpsocket_recive") func c_yudpsocket_recive(_ fd:Int32,buff:UnsafePointer<Byte>,len:Int32,ip:UnsafePointer<Int8>,port:UnsafePointer<Int32>) -> Int32
open class UDPServer: Socket {
public override init(address: String, port: Int32) {
super.init(address: address, port: port)
let fd = c_yudpsocket_server(address, port: port)
if fd > 0 {
self.fd = fd
}
}
//TODO add multycast and boardcast
open func recv(_ expectlen: Int) -> ([Byte]?, String, Int) {
if let fd = self.fd {
var buff: [Byte] = [Byte](repeating: 0x0,count: expectlen)
var remoteipbuff: [Int8] = [Int8](repeating: 0x0,count: 16)
var remoteport: Int32 = 0
let readLen: Int32 = c_yudpsocket_recive(fd, buff: buff, len: Int32(expectlen), ip: &remoteipbuff, port: &remoteport)
let port: Int = Int(remoteport)
var address = ""
if let ip = String(cString: remoteipbuff, encoding: String.Encoding.utf8) {
address = ip
}
if readLen <= 0 {
return (nil, address, port)
}
let rs = buff[0...Int(readLen-1)]
let data: [Byte] = Array(rs)
return (data, address, port)
}
return (nil, "no ip", 0)
}
open func close() {
guard let fd = self.fd else { return }
_ = c_yudpsocket_close(fd)
self.fd = nil
}
}

View File

@ -37,12 +37,14 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <dirent.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/select.h>
#include <sys/ioctl.h>
void ytcpsocket_set_block(int socket, int on) {
int flags;
@ -93,7 +95,6 @@ int ytcpsocket_connect(const char *host, int port, int timeout) {
return -4;//connect fail
}
ytcpsocket_set_block(sockfd, 1);
int set = 1;
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
return sockfd;
@ -105,6 +106,8 @@ int ytcpsocket_close(int socketfd){
}
int ytcpsocket_pull(int socketfd, char *data, int len, int timeout_sec) {
int readlen = 0;
int datalen = 0;
if (timeout_sec > 0) {
fd_set fdset;
struct timeval timeout;
@ -117,8 +120,26 @@ int ytcpsocket_pull(int socketfd, char *data, int len, int timeout_sec) {
return ret; // select-call failed or timeout occurred (before anything was sent)
}
}
int readlen = (int)read(socketfd, data, len);
return readlen;
// use loop to make sure receive all data
do {
readlen = (int)read(socketfd, data + datalen, len - datalen);
if (readlen > 0) {
datalen += readlen;
}
} while (readlen > 0);
return datalen;
}
int ytcpsocket_bytes_available(int socketfd) {
int count;
int callResult = ioctl(socketfd, FIONREAD, &count);
if (callResult < 0) {
return callResult;
}
return count;
}
int ytcpsocket_send(int socketfd, const char *data, int len){
@ -159,15 +180,31 @@ int ytcpsocket_listen(const char *address, int port) {
}
//return client socket fd
int ytcpsocket_accept(int onsocketfd, char *remoteip, int *remoteport) {
int ytcpsocket_accept(int onsocketfd, char *remoteip, int *remoteport, int timeouts) {
socklen_t clilen;
struct sockaddr_in cli_addr;
clilen = sizeof(cli_addr);
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(onsocketfd, &fdset);
struct timeval *timeptr = NULL;
struct timeval timeout;
if (timeouts > 0) {
timeout.tv_sec = timeouts;
timeout.tv_usec = 0;
timeptr = &timeout;
}
int status = select(FD_SETSIZE, &fdset, NULL, NULL, timeptr);
if (status != 1) {
return -1;
}
int newsockfd = accept(onsocketfd, (struct sockaddr *) &cli_addr, &clilen);
char *clientip=inet_ntoa(cli_addr.sin_addr);
memcpy(remoteip, clientip, strlen(clientip));
*remoteport = cli_addr.sin_port;
if (newsockfd > 0) {
int set = 1;
setsockopt(newsockfd, SOL_SOCKET, SO_NOSIGPIPE, (void*) &set, sizeof(int));
return newsockfd;
} else {
return -1;

View File

@ -48,6 +48,7 @@ int yudpsocket_server(const char *address, int port) {
//bind
struct sockaddr_in serv_addr;
memset( &serv_addr, '\0', sizeof(serv_addr));
serv_addr.sin_len = sizeof(struct sockaddr_in);
serv_addr.sin_family = AF_INET;
if (address == NULL || strlen(address) == 0 || strcmp(address, "255.255.255.255") == 0) {
@ -58,7 +59,6 @@ int yudpsocket_server(const char *address, int port) {
r = setsockopt(socketfd, SOL_SOCKET, SO_REUSEADDR, &reuseon, sizeof(reuseon));
serv_addr.sin_addr.s_addr = inet_addr(address);
serv_addr.sin_port = htons(port);
memset( &serv_addr, '\0', sizeof(serv_addr));
}
if (r == -1) {
@ -95,6 +95,10 @@ int yudpsocket_client() {
int socketfd = socket(AF_INET, SOCK_DGRAM, 0);
int reuseon = 1;
setsockopt(socketfd, SOL_SOCKET, SO_REUSEADDR, &reuseon, sizeof(reuseon));
//disable SIGPIPE as we'll handle send errors ourselves
int noSigPipe = 1;
setsockopt(socketfd, SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(noSigPipe));
return socketfd;
}

View File

@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = 'SwiftSocket'
s.version = '2.0.1'
s.version = '2.0.2'
s.summary = 'A cool framework to work with TCP and UDP sockets'
s.description = <<-DESC
SwiftSocket profieds an easy way to create TCP or UDP clients and servers 💁
SwiftSocket provides an easy way to create TCP or UDP clients and servers 💁
DESC
s.homepage = 'https://github.com/swiftsocket/SwiftSocket'
@ -23,6 +23,6 @@ Pod::Spec.new do |s|
:tag => s.version
}
s.source_files = 'Sources/**/*.{swift,c}'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5' }
end

View File

@ -33,12 +33,6 @@
375C48351DDC4C56008C701D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 375C48331DDC4C56008C701D /* Main.storyboard */; };
375C48371DDC4C56008C701D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 375C48361DDC4C56008C701D /* Assets.xcassets */; };
375C483A1DDC4C56008C701D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 375C48381DDC4C56008C701D /* LaunchScreen.storyboard */; };
37DA08A81E1FDD6D00C88E31 /* TCPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08A71E1FDD6D00C88E31 /* TCPServer.swift */; };
37DA08A91E1FDD6D00C88E31 /* TCPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08A71E1FDD6D00C88E31 /* TCPServer.swift */; };
37DA08AA1E1FDD6D00C88E31 /* TCPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08A71E1FDD6D00C88E31 /* TCPServer.swift */; };
37DA08B01E1FDE3500C88E31 /* UDPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08AF1E1FDE3500C88E31 /* UDPServer.swift */; };
37DA08B11E1FDE3500C88E31 /* UDPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08AF1E1FDE3500C88E31 /* UDPServer.swift */; };
37DA08B21E1FDE3500C88E31 /* UDPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DA08AF1E1FDE3500C88E31 /* UDPServer.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -61,8 +55,6 @@
375C483B1DDC4C56008C701D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
377DAA691DCDE40200009697 /* SwiftSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
377DAA761DCDE45D00009697 /* SwiftSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
37DA08A71E1FDD6D00C88E31 /* TCPServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TCPServer.swift; path = Sources/TCPServer.swift; sourceTree = SOURCE_ROOT; };
37DA08AF1E1FDE3500C88E31 /* UDPServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UDPServer.swift; path = Sources/UDPServer.swift; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -97,24 +89,22 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
375BC51D1DCDE86B006AD8F6 /* TCP */ = {
375BC51D1DCDE86B006AD8F6 /* TCPSocket */ = {
isa = PBXGroup;
children = (
372313941DCF84E30042DA87 /* TCPClient.swift */,
37DA08A71E1FDD6D00C88E31 /* TCPServer.swift */,
372313951DCF84E30042DA87 /* ytcpsocket.c */,
);
name = TCP;
name = TCPSocket;
sourceTree = "<group>";
};
375BC51E1DCDE878006AD8F6 /* UDP */ = {
375BC51E1DCDE878006AD8F6 /* UDPSocket */ = {
isa = PBXGroup;
children = (
372313901DCF84D80042DA87 /* UDPClient.swift */,
37DA08AF1E1FDE3500C88E31 /* UDPServer.swift */,
372313911DCF84D80042DA87 /* yudpsocket.c */,
);
name = UDP;
name = UDPSocket;
sourceTree = "<group>";
};
375C482E1DDC4C56008C701D /* iOS Example */ = {
@ -166,8 +156,8 @@
children = (
372313981DCF84EC0042DA87 /* Result.swift */,
372313991DCF84EC0042DA87 /* Socket.swift */,
375BC51D1DCDE86B006AD8F6 /* TCP */,
375BC51E1DCDE878006AD8F6 /* UDP */,
375BC51D1DCDE86B006AD8F6 /* TCPSocket */,
375BC51E1DCDE878006AD8F6 /* UDPSocket */,
377DAA6A1DCDE40200009697 /* Supporting Files */,
);
name = Source;
@ -283,11 +273,12 @@
attributes = {
LastSwiftMigration = 0710;
LastSwiftUpdateCheck = 0810;
LastUpgradeCheck = 0710;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = swift;
TargetAttributes = {
37454EC91E06158200800AE5 = {
CreatedOnToolsVersion = 8.2;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
375C482C1DDC4C56008C701D = {
@ -296,18 +287,19 @@
};
377DAA681DCDE40200009697 = {
CreatedOnToolsVersion = 8.1;
LastSwiftMigration = 0810;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
377DAA751DCDE45D00009697 = {
CreatedOnToolsVersion = 8.1;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 5518C82A19A3290F0049DC22 /* Build configuration list for PBXProject "SwiftSocket" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@ -367,11 +359,9 @@
files = (
37454EE31E06163D00800AE5 /* UDPClient.swift in Sources */,
37454EE01E06163D00800AE5 /* Socket.swift in Sources */,
37DA08B21E1FDE3500C88E31 /* UDPServer.swift in Sources */,
37454EE41E06163D00800AE5 /* yudpsocket.c in Sources */,
37454EDF1E06163D00800AE5 /* Result.swift in Sources */,
37454EE21E06163D00800AE5 /* ytcpsocket.c in Sources */,
37DA08AA1E1FDD6D00C88E31 /* TCPServer.swift in Sources */,
37454EE11E06163D00800AE5 /* TCPClient.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -391,11 +381,9 @@
files = (
372313931DCF84D80042DA87 /* yudpsocket.c in Sources */,
3723139A1DCF84EC0042DA87 /* Result.swift in Sources */,
37DA08B01E1FDE3500C88E31 /* UDPServer.swift in Sources */,
3723139B1DCF84EC0042DA87 /* Socket.swift in Sources */,
372313921DCF84D80042DA87 /* UDPClient.swift in Sources */,
372313971DCF84E30042DA87 /* ytcpsocket.c in Sources */,
37DA08A81E1FDD6D00C88E31 /* TCPServer.swift in Sources */,
372313961DCF84E30042DA87 /* TCPClient.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -406,11 +394,9 @@
files = (
37454EDC1E06163C00800AE5 /* UDPClient.swift in Sources */,
37454ED91E06163C00800AE5 /* Socket.swift in Sources */,
37DA08B11E1FDE3500C88E31 /* UDPServer.swift in Sources */,
37454EDD1E06163C00800AE5 /* yudpsocket.c in Sources */,
37454ED81E06163C00800AE5 /* Result.swift in Sources */,
37454EDB1E06163C00800AE5 /* ytcpsocket.c in Sources */,
37DA08A91E1FDD6D00C88E31 /* TCPServer.swift in Sources */,
37454EDA1E06163C00800AE5 /* TCPClient.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -461,8 +447,8 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -493,8 +479,8 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -518,7 +504,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -541,7 +527,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@ -575,7 +561,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@ -609,7 +595,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@ -637,7 +623,7 @@
PRODUCT_NAME = SwiftSocket;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
};
@ -663,7 +649,7 @@
PRODUCT_NAME = SwiftSocket;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
@ -674,17 +660,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
@ -692,6 +689,7 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@ -711,7 +709,7 @@
PRODUCT_NAME = "";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@ -719,23 +717,35 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@ -747,7 +757,8 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "";
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
};
name = Release;
};

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -12,9 +12,8 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}