Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash client sends to Windows server - server hangs #4

Open
Ohmnivore opened this issue Jun 13, 2015 · 6 comments
Open

Flash client sends to Windows server - server hangs #4

Ohmnivore opened this issue Jun 13, 2015 · 6 comments

Comments

@Ohmnivore
Copy link

In the Server.hx pump function, in the try block, in the while(true) block, the server receives an ever-lasting stream of zeros (from readByte()). This causes it to hang in the while loop. I guess it's because flash and native sockets behave differently, but I don't know enough about them to understand what's going in.

I'm more than willing to help solve this issue, I'm just really confused right now. Could you give me a few pointers about the differences between flash and native sockets?

@Ohmnivore
Copy link
Author

On the plus side receiving messages from a windows server with a flash client works like a charm :)

@Ohmnivore
Copy link
Author

Just clarifying, I'm sending a string using the Prefixed protocol. However this doesn't really matter, as while reading the socket input the data goes something like this:

(each character represents a byte)
0, 0, 0, 0, ...more zeroes, 0, 1, 3, 67, 78, 103, ...more data, 0, 0, 0, ...more zeroes

it never finished processing the first received message since it's stuck in the while loop, reading zeroes, and no exception is thrown

@Dvergar
Copy link
Owner

Dvergar commented Jun 13, 2015

Thanks for reporting, this is related to #3 . What's weird is that i have several apps working with it and I don't get those issues so i'm not sure if that's a special case or a regression, in any case it probably needs more tests. I'll probably switch to a hxnet style buffering. Hoping for a commit later today.

@Ohmnivore
Copy link
Author

Replacing the contents of the while block with the hxnet code below works perfectly, the pain is over. I haven't tested for cpp to cpp and the three other configurations though, but can confirm it fixes the flash(client) to cpp(server) issue. Overall flash client and cpp server case is working 10/10.

bytesReceived = socket.input.readBytes(buffer, 0, buffer.length);
// check that buffer was filled
if (bytesReceived > 0)
{
    protocol.dataReceived(new BytesInput(buffer, 0, bytesReceived));
}

(hxnet.tcp.Server.hx, lines 75-80)

@f-rank
Copy link

f-rank commented Jun 14, 2015

Could this solve #3 ?

@Ohmnivore
Copy link
Author

I don't know, tbh I can't reproduce #3. What I thought was #3 at the time was actually this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants