Quantcast
Channel: Recent Discussions — Mixed Reality Developer Forum
Viewing all articles
Browse latest Browse all 10543

hololens socket can't receive full packet

$
0
0

A simple summary:

boost asio server, send a video frame 1280x720x3 with simple compression
packet size is 186476, not really to much
Nothing to complicated. Anyway, no matter if i test it in the hololens emulator or on the physical device it doesn't make a difference

// uint32_t data_length == size of frame 'data_ptr'
enum max_length = sizeof(uint32_t);
memcpy(data_, &data_length, max_length);
auto length = boost::asio::write(*socket_, boost::asio::buffer(data_, max_length), e);
length = boost::asio::write(*socket_, boost::asio::buffer(data_ptr, data_length), e);

// receive
char data_[max_length] = { 0 };

fd_set readSet;
FD_ZERO(&readSet);
FD_SET(_socket, &readSet);
timeval timeout;
timeout.tv_sec = 0; // Zero timeout (poll)
timeout.tv_usec = 0;

auto result = select(_socket, &readSet, nullptr, nullptr, &timeout);
if (result == 0)
continue;

result = recv(_socket, data_, max_length, 0);
if (result == SOCKET_ERROR) {
closesocket(_socket);
_socket = INVALID_SOCKET;
break;
}

uint32_t msg_size(0);
memcpy(&msg_size, data_, max_length);

std::vector<char> vec(msg_size);
result = recv(_socket, &vec[0], msg_size, 0);

while (result < msg_size) {
result += recv(_socket, &vec[result], msg_size - result, 0);
}

but the hololens can't receive the full packet, i try it also with the .net streamsockets, same result. it tried a few times and then recv blocks in the while loop and doesn't receive anymore.

I also do some tests if there is coming a -1 on recv, but it isn't. I add some logging to see more informations. At the first call it recv 16060. In the second call 1460. Then it hangs and doesn't recv anymore. If i break or kill the Test i see in the boost asio server that it has send 131072.

anyone, any idea? is it an uwp app problem, that i can't receive 'bigger' packets, or get it killed because it takes too long?


Viewing all articles
Browse latest Browse all 10543

Trending Articles