Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. socket = new Socket(host, port);
  2. socket.setTcpNoDelay(true);
  3.  
  4. while(!dataList.isEmpty()) {
  5. String data = dataList.removeFirst();
  6. inMemoryCount -= data.length();
  7. try {
  8. OutputStream os = socket.getOutputStream();
  9. os.write(data.getBytes());
  10. os.flush();
  11. }
  12. catch(IOException e) {
  13. inMemoryCount += data.length();
  14. dataList.addFirst(data);
  15. socket = null;
  16. return false;
  17. }
  18. }
  19.  
  20. return true;
Add Comment
Please, Sign In to add comment