gcdasyncsocket

set max packet size for GCDAsyncUdpSocket

左心房为你撑大大i 提交于 2020-01-15 17:47:21
问题 I am using the GCDAsyncUdpSocket to send/receive data to a multicast group. In the GCDAsyncUdpSocket.m file, I found the setting bellow and changed the value to 32768 for example. But I can't still receive any packet that is larger than 9216 bytes. max4ReceiveSize = 9216; max6ReceiveSize = 9216; Is there another setting? Edit: I discovered that the GCDAsyncUdpSocket class did provide a method to set this value called setMaxReceiveIPv4BufferSize. Tried that but it still only received at around

GCDAsyncSocket server receive data only first time

元气小坏坏 提交于 2020-01-12 03:54:46
问题 Client sent message every time when I press send button but Server receive message only first time. What is the issue in server Server: - (void)viewDidLoad { [super viewDidLoad]; asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; NSError *err = nil; if (![asyncSocket acceptOnPort:10000 error:&err]){ NSLog(@"Error in acceptOnPort:error: -> %@", err); } } - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket {

SOCKS5 connection times out (GCDAsyncSocket). (OpenFire, XEP-0065 and iOS XMPPFramework)

落花浮王杯 提交于 2019-12-30 05:22:10
问题 Problem : I am attempting a TURNSocket (XEP-0065 - SOCKS5) using the iOS XMPPFramework and an OpenFire Server. I want to be able to send and receive files. However, in most scenarios, the receiver returns no response. I currently suspect the problem is to do with the OpenFire proxy server, which times out! This is set up on the local network, and I have edited the hosts file to point to it. Note : The base of my code is from the following tutorial : http://mobile.tutsplus.com/tutorials/iphone

Socket的简单使用

爱⌒轻易说出口 提交于 2019-12-30 00:41:30
一.Socket: Socket又称”套接字" 网络上的两个程序通过一个 双向的通信链接实现数据 的交换,这个连接的一端成为一个socket 应用程序通常通过”套接字”向网络发出请求或者应答网络请 二.网络通信的要素 网络上的请求就是通过socket来建立链接然后互相通信 ip地址(网络上主机设备的唯一标识) 端口号(定位程序) 用于标示进程的逻辑地址,不同进程的标示 有效端口:0~65535,其中0~1024由系统使用或者保留端口,开发中建议使用1024以上的端口 传输协议 通信的规则-->常见协议:TCP UDP 三.TCP和UDP TCP(传输控制协议) 建立链接,形成传输数据的通道 在链接中进行打暑假传输(数据不受到限制 ) 通过三次握手完成链接,是可靠协议,安全送达 必须建立链接,效率会稍低 UDP(用户数据报协议) 将数据及源和目的封装成数据包中,不需要建立链接 每个数据报的大小限制在64k之内 因为无需链接,因此是不可靠协议 不需要建立链接,速度快 四.Socket通信流程图 五.实现Socket服务端监听 实现socket的方法 1.使用c语言实现 2.使用cocoaAsyncSocket(OC)第三方框架,内部是对C的封装 Telnet命令 telnet host port/telnet --> 192.168.10.10 5288 1

gcdasyncsocket background file transfer

穿精又带淫゛_ 提交于 2019-12-25 01:13:30
问题 Having two devices that need to keep transferring data while in background or in LockScreen. The main resource about backgrounding is available on https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html So far I'm looking forward to understand how is it expected to implement such above mentioned behaviour: in a scenario where a transfer is in progress and one of the apps (or both) goes into background.

GCDAsyncUdpSocket cannot bind port on iOS simulator

萝らか妹 提交于 2019-12-24 01:48:13
问题 I'm working on sending message through UDP. However, I've been trapped in the problem about 'binding port'. When I built the project on iOS simulator first time, nothing strange happened. Everything was fine. But when I built the project second time. I got an error message from terminal when the app tried to bind port. The message goes like this "Error Domain=NSPOSIXErrorDomain Code=48 "Address already in use" UserInfo=0x767c830 {NSLocalizedFailureReason=Error in bind() function,

GCDAsyncSocket alters data while transporting it

限于喜欢 提交于 2019-12-23 04:01:54
问题 I'm making a multiplayer iOS game and have run into the following issue: i send a dictionary with an array of custom objects inside it. These custom objects conform to NSCoding . I convert the dictionary to NSData like this: NSData *data = [NSKeyedArchiver archivedDataWithRootObject:packet]; Then send it [asyncSocket writeData:data withTimeout:-1 tag:tag]; Receive [sock readDataWithTimeout:-1 tag:tag]; And try to unarchive NSDictionary *dict = [NSKeyedUnarchiver unarchiveObjectWithData:data];

GCDAsyncUDPSocket source address returns null

余生长醉 提交于 2019-12-22 18:32:11
问题 google code question mirror: https://groups.google.com/forum/#!topic/cocoaasyncsocket/grhjZSMLr3U here is my code that is reading the response: - (void)init { udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; NSError *error = nil; if (![udpSocket bindToPort:UDP_PORT error:&error]) { //not connecting to host return; } if (![udpSocket beginReceiving:&error]) { return; } } - (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *

GCDAsyncSocket in Swift

£可爱£侵袭症+ 提交于 2019-12-21 05:10:46
问题 I want to open a TCP connection with an OBD dongle based on ELM327 chip. So I have decided to use GCDAsyncSocket library. I wrote this code, import UIKit import CocoaAsyncSocket class ViewController: UIViewController, GCDAsyncSocketDelegate { let addr = "192.168.0.10" let port:UInt16 = 35000 var socket:GCDAsyncSocket! override func viewDidLoad() { super.viewDidLoad() socket = GCDAsyncSocket(delegate: self, delegateQueue: dispatch_get_main_queue()) do { try socket.connectToHost(addr, onPort:

How to use GCDAsyncUdpSocket for multicast over wifi and bluetooth

℡╲_俬逩灬. 提交于 2019-12-18 13:47:26
问题 I am currently using GCDAsyncUdpSocket to send multicast datagrams over wifi between iOS devices. The Code is pretty simple.. Client self.socket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; //omitted error checking [self.socket bindToPort:12345 error:&err]; [self.socket joinMulticastGroup:@"224.0.1.1" error:&err]; [self.socket beginReceiving:&err]; Server self.multicastSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue