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

Tcp Incomplete receiving data #212

Open
ShineYangGod opened this issue May 18, 2022 · 1 comment
Open

Tcp Incomplete receiving data #212

ShineYangGod opened this issue May 18, 2022 · 1 comment

Comments

@ShineYangGod
Copy link

After connecting to TCP, I waited to receive data after sending data, and found that only half of the received data was received. How to solve the problem of not receiving half of the data received
截屏2022-05-18 15 40 54

@dannys42
Copy link
Contributor

Unlike websockets, read and writes for TCP sockets are not guaranteed to be of any particular size and may chop your message such that you need multiple read's to get the full message. You can find similar discussions in Issue 204 and Issue 176.

I recently made a PacketProcessor for Swift that may help in managing your buffers in these situations. I have some tutorials, but I do not yet have an example that demonstrates using it in conjunction with raw sockets.

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

2 participants