-
Notifications
You must be signed in to change notification settings - Fork 197
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
Swift bluesocket Can't get long data ? #204
Comments
Could you provide a minimum example to reproduce it? Thanks. |
I used the testReadWrite method in dome, normal data can be received, but long data cannot be received |
我的代码.zip |
Hello, what's the matter with my question? Can it be solved? |
@ShineYangGod I'm not sure what you mean by "long data". // let hello = "Hello from client..."
let hello = String(repeating: "Hello from client...", count: 1000) and everything works fine. |
Wait a minute, I will give you a long data example |
MintBlueTCPSocketMangent.swift.zip This is what I use now, and finally there is an example of the data returned by our gateway |
If I'm using the data (end of your doc) directly in the sample, it works fine. I think the issue should be somewhere else, either in the setup or in the delay induced by your gateway maybe? |
If i directly use SocketTests.testReadWrite Is it possible to connect to TCP and send data and receive data? |
I tested it several times, and it seems that the client stopped receiving after receiving a few pieces of data. How do I set the client to continue to receive data? |
After testing, our gateway is no problem. I tried other third-party sockets, and there is no problem. Now, when we use our socket to receive messages, we can’t achieve continuous reception. |
@ShineYangGod This sounds similar to this issue. TCP sockets can operate in a blocking or non-blocking fashion. When using non-blocking (which I think is the default), you are not guaranteed to get any specific number of bytes upon read. So when you run things locally you might see that you get all your data instantaneously, but when you go through any router, your data may be "chunked" in an arbitrary way. You can read more details in this Stack Overflow discussion as well. |
Can you give a specific example? |
Why is the tcp connection so slow? And the message sent to the server is very slow. I have no problem with other sockets, and I looked at the log and did not receive the message sent. |
Hi @ShineYangGod can you provide a working example? I'm looking at the If the client socket is blocking, then the first If the client socket is non-blocking, then So either way I think there are issues with your socket handling. |
1 similar comment
Hi @ShineYangGod can you provide a working example? I'm looking at the If the client socket is blocking, then the first If the client socket is non-blocking, then So either way I think there are issues with your socket handling. |
MintBlueTCPSocketMangent.swift.zip |
When I use tcp to connect successfully, I need to get a long data, but nothing is returned
The text was updated successfully, but these errors were encountered: