I wrote a program on Android and Linux conduct Socket Communications, but sometimes delay sending data, and sometimes can be sent out immediately, sometimes for several seconds delay part of the code is as follows:.
...
socket = new Socket (SERVER_IP, PORT);
ou = socket.getOutputStream ();
in = socket.getInputStream ();
...
public void SendMsg (byte [] msg) throws IOException {
ou.write (msg);
ou.flush ();
}
How to write the data to the stream can be sent out immediately? Help Great God ~
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Their top ~! Come Pathwalker ~
Reply:
Their top! Great God who ~
Reply:
Stand-alone CSDN?
Reply:
Bangding, the landlord has added ou.flush (); supposedly added the phrase should immediately wrote.
Reply:
Although C #, but there is a reference value.
Ask socket send large amounts of data latency issues
http://topic.csdn.net/u / 20110302/18/9a4587ef-6620-4dfd-9f76-4c8c792c9080.html
Reply:
Well finally not alone in tears - a ...
Reply:
Each time a frame of data sent about 8 - 20 bytes, because it is so much the amount of data to send commands.
Reply:
Not written to the stream to immediately sent to fetch data until the TCP protocol stack to send is sent immediately without delay
Reply:
I am very troubled by this issue.
Sometimes in a good WIFI network will have a great delay. Information unable to go slow, not received.
Then after a while get a lot of clicking. .
Reply:
This problem is not thinking right ah ah
Reply:
You are wifi connection you, did not appear to find the reasons for the delay, find a sniffer Analysis
Reply:
Memory, is the tcp protocol, is full before sending, or try the bigger master myself to try such as sending a 1024 byte, wifi is not very used to send me delay it
Reply:
Problem solved. Was compiled before the android system problems, thank you!
Reply:
Can detail next, why is the system lead socket slowly? On a recent project encountered the same problem on the phone to send and receive speeds slower than doubled on PC
No comments:
Post a Comment