我试图在iOS中增加套接字缓冲区大小,但到目前为止,我只能获得1 MB的最大大小。
我听说它可以延长到4 MB,有人可以帮忙吗?
uint8_t buffer[1024*4];
int len;
NSMutableString *output = [[NSMutableString alloc] init];
while ([inputStream hasBytesAvailable])
{
len = (int)[inputStream read:buffer maxLength:sizeof(buffer)];
if (len > 0)
{
[output appendString: [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding]];
}
}
if (output.length > 0)
{
[self messageReceived:output];
}