asyncsocket

Boost.asio and asynchronous chain, unique_ptr?

纵饮孤独 提交于 2020-07-06 12:24:28
问题 I am not deeply familiar with async programming and I have a question. My question is the following. Given the echo_server example here for C++11 in boost.asio: http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp I would like to know if the std::make_shared<session> can be replaced in C++14 with a std::unique_ptr<session> in C++14, avoiding the overhead of reference count. I am not sure since we have shared_from_this() but not something like unique

How to separate data received? using asyncsocket

纵饮孤独 提交于 2020-01-24 01:37:06
问题 I am trying to make a app that can connect to a device and ask for a query. To be able to have the a reply, I need to send an NSString command first. I have it in a loop with NSTimer . I normally have like this in Interface Builder Read: SIDDA1999AP then after some time changed to Read: @REL10345 and so on until the last string send @"H\r\n" then back to the first one. Part of my code base in Asyncsocket - (void)viewDidLoad { [super viewDidLoad]; // Read Data as loaded NSTimer *t; t =

SocketAsyncEventArgs buffer is full of zeroes

半腔热情 提交于 2020-01-22 20:09:16
问题 I'm writing a message layer for my distributed system. I'm using IOCP, ie the Socket.XXXAsync methods. Here's something pretty close to what I'm doing (in fact, my receive function is based on his): http://vadmyst.blogspot.com/2008/05/sample-code-for-tcp-server-using.html What I've found now is that at the start of the program (two test servers talking to each other) I each time get a number of SAEA objects where the .Buffer is entirely filled with zeroes, yet the .BytesTransferred is the

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

Asyncsockets and “silent” disconnections

狂风中的少年 提交于 2020-01-09 08:05:35
问题 I've been using cocoaasyncsocket as a client to a Windows .net server using asyncsocket. I am encoding messages using ProtocolBuffers. Together, these make a great set of tools. However recently I have noticed that if I leave the client connected to the server for a long time - many hours - when I try to make a request for data, the message appears to get sent but never arrives at the server. I'm calling this a "silent" disconnection because I'm not receiving the usual disconnection that I

AsyncSocket: getting merged two packets instead of separate two packets

跟風遠走 提交于 2020-01-06 09:05:56
问题 I'm executing 4 startup commands and also expecting to receive 4 responses. The server is already implemented and another dev who is developing android, is able to receive those 4 separate responses, however, I'm getting 2 good responses (separate) and then 3rd and 4th responses come as one response. I'v placed NSLog of NSData result in completeCurrentRead, and it outputs me merged packet "0106000000000b0600000000" instead of separate packets "010600000000" and "0b0600000000". I'v also tested

AsyncSocket: getting merged two packets instead of separate two packets

北慕城南 提交于 2020-01-06 09:04:30
问题 I'm executing 4 startup commands and also expecting to receive 4 responses. The server is already implemented and another dev who is developing android, is able to receive those 4 separate responses, however, I'm getting 2 good responses (separate) and then 3rd and 4th responses come as one response. I'v placed NSLog of NSData result in completeCurrentRead, and it outputs me merged packet "0106000000000b0600000000" instead of separate packets "010600000000" and "0b0600000000". I'v also tested

Transfer data from android to java desktop application

梦想的初衷 提交于 2020-01-06 08:17:29
问题 I run an application in Android and a string value as an answer. Now I want to pass this result to the Java server which is on my localhost, i.e pass the value from Android code to Java desktop application. I tried using this code, but when I run the client it says unfortunately the application has stopped. It says: android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) libcore.io.IoBridge.connectErrno(IoBridge.java

Transfer data from android to java desktop application

徘徊边缘 提交于 2020-01-06 08:17:10
问题 I run an application in Android and a string value as an answer. Now I want to pass this result to the Java server which is on my localhost, i.e pass the value from Android code to Java desktop application. I tried using this code, but when I run the client it says unfortunately the application has stopped. It says: android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) libcore.io.IoBridge.connectErrno(IoBridge.java

Equivalent of Peek in C# async sockets?

杀马特。学长 韩版系。学妹 提交于 2020-01-06 01:57:48
问题 I'm used to using synchronous sockets. In order to deal with messages that have not completely arrived yet, I'd set the first 4 bytes to be the expected length of the message. Then I'd use Socket.Receive(tcpRecv, 1024, SocketFlags.Peek); to take a look at the message without pulling it off the buffer. If all of it was there, I'd pull the data. If it wasn't, I'd leave it there. I had designed my protocol so that no message would ever be greater than 1024 bytes. In asynchronous sockets, I don't