java - PrintStream Println behaves differently on diff machines? -


I have a simple server and client software to simulate a readliner on the server running on the mac and socket in C Written is my custom code.

Customers written in Java for Android and Window machines I'm seeing strange behavior with printline calls. The code looks like this

  printstream ps = new printstream (clientSocket.getOutputStream ()); JSONObject json = New JSONObject (responseMap); String buffer = json.toString (); Ps.println (buffer); Ps.flush ();   

When printlines run on windows, send buffer / r / n after the string. When running on Android, the printline sends / n after the buffer string.

Should not the difference in the behavior of printline / OS / machines be compatible?

Should the behavior of println not be compatible in OS / machines?

PrintStream retrieves the separator from the platform's line and sends it to the built-in stream.

Windows and Android have different line separators.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -