Data isn't transmitted between QTcpSockets and Java SocketsWhat is the difference between a port and a socket?What is the difference between public, protected, package-private and private in Java?What's the difference between SoftReference and WeakReference in Java?Is there a limit on number of tcp/ip connections between machines on linux?What's the difference between getPath(), getAbsolutePath(), and getCanonicalPath() in Java?Unable to send message from client to serverDifference between <? super T> and <? extends T> in JavaWhat is the difference between == and equals() in Java?What is the difference between canonical name, simple name and class name in Java Class?multi function socket java, socket vs NIO socket

Does the talk count as invited if my PI invited me?

Why aren't satellites disintegrated even though they orbit earth within earth's Roche Limits?

Can more than one instance of Bend Luck be applied to the same roll by multiple Wild Magic sorcerers?

Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?

How to scale and shift the coordinates of a Graphics object?

How to get all possible paths in 0/1 matrix better way?

Taylor series leads to two different functions - why?

Good examples of "two is easy, three is hard" in computational sciences

Told to apply for UK visa before other visas

Largest memory peripheral for Sinclair ZX81?

Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"

Cycling to work - 30mile return

Combining two Lorentz boosts

How do you cope with rejection?

Quotient of Three Dimensional Torus by Permutation on Coordinates

Why is choosing a suitable thermodynamic potential important?

Prints each letter of a string in different colors. C#

Why does string strummed with finger sound different from the one strummed with pick?

How does this piece of code determine array size without using sizeof( )?

Working hours and productivity expectations for game artists and programmers

What should I wear to go and sign an employment contract?

Why use a retrograde orbit?

Windows reverting changes made by Linux to FAT32 partion

How do we explain the use of a software on a math paper?



Data isn't transmitted between QTcpSockets and Java Sockets


What is the difference between a port and a socket?What is the difference between public, protected, package-private and private in Java?What's the difference between SoftReference and WeakReference in Java?Is there a limit on number of tcp/ip connections between machines on linux?What's the difference between getPath(), getAbsolutePath(), and getCanonicalPath() in Java?Unable to send message from client to serverDifference between <? super T> and <? extends T> in JavaWhat is the difference between == and equals() in Java?What is the difference between canonical name, simple name and class name in Java Class?multi function socket java, socket vs NIO socket






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















So I have two applications, one is written in C++ using Qt5 and the other one is written in Java. The C++ application acts as a client that connects to a ServerSocket object in the java application which then instantiates a socket from the connection. When I then try to send a string to the server, I either have to send the string repetitively (like 20000 times) or the server doesn't receive anything at all.



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
while(!sock->waitForBytesWritten(3000))
out << s << endl;



Where the code above would not yield any results, the following yields segmented strings as well as duplicate received strings for the server:



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
do
out << s << endl;
while(!sock->waitForBytesWritten(3000) | 1);


The server is a simple java program like this:



ServerSocket ss = new ServerSocket(5000);
Socket s = ss.accept();
DataInputStream in = new DataInputStream(s.getInputStream());
while (true){
String tmp = in.readUTF();
System.out.println(tmp);
if (tmp.contains(" "))
break;



I would expect the output to be a simple This is a test string that will be sent to the server upon connection; however, the result is either nothing or something along these lines:



his is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection


Do you have any idea as to how I can resolve this issue?










share|improve this question






















  • I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

    – markspace
    Mar 23 at 17:34











  • Flushing made no difference

    – Ohunter
    Mar 23 at 17:40











  • Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

    – user4581301
    Mar 23 at 17:42











  • Do you have an idea as to how I would do that in Qt?

    – Ohunter
    Mar 23 at 17:47











  • If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

    – markspace
    Mar 23 at 17:48

















0















So I have two applications, one is written in C++ using Qt5 and the other one is written in Java. The C++ application acts as a client that connects to a ServerSocket object in the java application which then instantiates a socket from the connection. When I then try to send a string to the server, I either have to send the string repetitively (like 20000 times) or the server doesn't receive anything at all.



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
while(!sock->waitForBytesWritten(3000))
out << s << endl;



Where the code above would not yield any results, the following yields segmented strings as well as duplicate received strings for the server:



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
do
out << s << endl;
while(!sock->waitForBytesWritten(3000) | 1);


The server is a simple java program like this:



ServerSocket ss = new ServerSocket(5000);
Socket s = ss.accept();
DataInputStream in = new DataInputStream(s.getInputStream());
while (true){
String tmp = in.readUTF();
System.out.println(tmp);
if (tmp.contains(" "))
break;



I would expect the output to be a simple This is a test string that will be sent to the server upon connection; however, the result is either nothing or something along these lines:



his is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection


Do you have any idea as to how I can resolve this issue?










share|improve this question






















  • I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

    – markspace
    Mar 23 at 17:34











  • Flushing made no difference

    – Ohunter
    Mar 23 at 17:40











  • Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

    – user4581301
    Mar 23 at 17:42











  • Do you have an idea as to how I would do that in Qt?

    – Ohunter
    Mar 23 at 17:47











  • If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

    – markspace
    Mar 23 at 17:48













0












0








0








So I have two applications, one is written in C++ using Qt5 and the other one is written in Java. The C++ application acts as a client that connects to a ServerSocket object in the java application which then instantiates a socket from the connection. When I then try to send a string to the server, I either have to send the string repetitively (like 20000 times) or the server doesn't receive anything at all.



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
while(!sock->waitForBytesWritten(3000))
out << s << endl;



Where the code above would not yield any results, the following yields segmented strings as well as duplicate received strings for the server:



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
do
out << s << endl;
while(!sock->waitForBytesWritten(3000) | 1);


The server is a simple java program like this:



ServerSocket ss = new ServerSocket(5000);
Socket s = ss.accept();
DataInputStream in = new DataInputStream(s.getInputStream());
while (true){
String tmp = in.readUTF();
System.out.println(tmp);
if (tmp.contains(" "))
break;



I would expect the output to be a simple This is a test string that will be sent to the server upon connection; however, the result is either nothing or something along these lines:



his is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection


Do you have any idea as to how I can resolve this issue?










share|improve this question














So I have two applications, one is written in C++ using Qt5 and the other one is written in Java. The C++ application acts as a client that connects to a ServerSocket object in the java application which then instantiates a socket from the connection. When I then try to send a string to the server, I either have to send the string repetitively (like 20000 times) or the server doesn't receive anything at all.



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
while(!sock->waitForBytesWritten(3000))
out << s << endl;



Where the code above would not yield any results, the following yields segmented strings as well as duplicate received strings for the server:



QString s = " This is a test string that will be sent to the server upon connectionn";
QTcpSocket *sock = new QTcpSocket;
sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);
sock->waitForConnected(5000);
QTextStream out(sock);
do
out << s << endl;
while(!sock->waitForBytesWritten(3000) | 1);


The server is a simple java program like this:



ServerSocket ss = new ServerSocket(5000);
Socket s = ss.accept();
DataInputStream in = new DataInputStream(s.getInputStream());
while (true){
String tmp = in.readUTF();
System.out.println(tmp);
if (tmp.contains(" "))
break;



I would expect the output to be a simple This is a test string that will be sent to the server upon connection; however, the result is either nothing or something along these lines:



his is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection

This is a test string that will be sent to the server upon connection


Do you have any idea as to how I can resolve this issue?







java c++ qt sockets tcp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 17:22









OhunterOhunter

936




936












  • I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

    – markspace
    Mar 23 at 17:34











  • Flushing made no difference

    – Ohunter
    Mar 23 at 17:40











  • Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

    – user4581301
    Mar 23 at 17:42











  • Do you have an idea as to how I would do that in Qt?

    – Ohunter
    Mar 23 at 17:47











  • If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

    – markspace
    Mar 23 at 17:48

















  • I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

    – markspace
    Mar 23 at 17:34











  • Flushing made no difference

    – Ohunter
    Mar 23 at 17:40











  • Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

    – user4581301
    Mar 23 at 17:42











  • Do you have an idea as to how I would do that in Qt?

    – Ohunter
    Mar 23 at 17:47











  • If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

    – markspace
    Mar 23 at 17:48
















I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

– markspace
Mar 23 at 17:34





I don't know "Q" but if I was writing the client in Java I'd have to send a "flush" after the call to out to get it to actually send the packet.

– markspace
Mar 23 at 17:34













Flushing made no difference

– Ohunter
Mar 23 at 17:40





Flushing made no difference

– Ohunter
Mar 23 at 17:40













Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

– user4581301
Mar 23 at 17:42





Flushing would push the message out of the stream's buffer and into the network stack, but TCP offers no guarantees that the network stack won't buffer it or split it across multiple TCP packets. If you want to send discrete messages in a TCP stream, you need to wrap the messages in a protocol.

– user4581301
Mar 23 at 17:42













Do you have an idea as to how I would do that in Qt?

– Ohunter
Mar 23 at 17:47





Do you have an idea as to how I would do that in Qt?

– Ohunter
Mar 23 at 17:47













If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

– markspace
Mar 23 at 17:48





If flushing makes no difference, then I think your protocol stack is broken. Better go ask the QT folks how their stuff works. While a "flush" isn't guaranteed, a protocol stack should make a best effort to send the data out on the wire, and realistically that should always succeed.

– markspace
Mar 23 at 17:48












2 Answers
2






active

oldest

votes


















0














So the solution was to read the data into a byte[] and then convert using a the string constructor to a string as such:



ServerSocket ss = new ServerSocket(5000);

Socket s = ss.accept();

DataInputStream in = new DataInputStream(s.getInputStream());

byte[] b = new byte[1024];
in.read(b);

String tmp = new String(b, "UTF8");
System.out.println(b);
System.out.println(tmp);


I have no idea why, but it is the solution I arrived at. The client almost stayed the same although minor changes were made:



QString s = "This is a test string that will be sent to the server upon connectionn";

QTcpSocket *sock = new QTcpSocket;

sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);

sock->waitForConnected(5000);


do
sock->write(s.toUtf8());
sock->flush();

sock->waitForBytesWritten();
while (sock->isValid() && sock->bytesToWrite() > 0);





share|improve this answer























  • See my note (5) to understand why your solution works.

    – Jens
    Mar 23 at 22:39


















0














(1) waitForBytesWritten may fail on Windows - better use the signal bytesWritten()



(2) The loop



while(!sock->waitForBytesWritten(3000) | 1);


looks like an endless loop to me independent of the return code from waitForBytesWritten



(3) What is the idea of waitForBytesWritten in the context of your program? It may return after the first byte written to the stream!



(4) What's the idea of



if (tmp.contains(" ")){
break;


To me, this looks like it might break after any blank received - e.g. the first blank after "This". It might as well break after several lines, depending on how much readUTF delivers (I'm not an expert in Java).



(5) readUTF expects Strings in modified UTF8 format, but Qt will not send Strings in modified UTF8 (with a leading 16 bit Integer containing the length). Thus Java will interpret the first two characters ('Th') as length and then the lottery may start - depending on these two characters, the decoding will return seemingly arbitrary results.






share|improve this answer























  • So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

    – Ohunter
    Mar 23 at 22:40











  • Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

    – Jens
    Mar 23 at 22:44











  • But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

    – Ohunter
    Mar 23 at 22:46











  • UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

    – Jens
    Mar 25 at 8:42











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316424%2fdata-isnt-transmitted-between-qtcpsockets-and-java-sockets%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














So the solution was to read the data into a byte[] and then convert using a the string constructor to a string as such:



ServerSocket ss = new ServerSocket(5000);

Socket s = ss.accept();

DataInputStream in = new DataInputStream(s.getInputStream());

byte[] b = new byte[1024];
in.read(b);

String tmp = new String(b, "UTF8");
System.out.println(b);
System.out.println(tmp);


I have no idea why, but it is the solution I arrived at. The client almost stayed the same although minor changes were made:



QString s = "This is a test string that will be sent to the server upon connectionn";

QTcpSocket *sock = new QTcpSocket;

sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);

sock->waitForConnected(5000);


do
sock->write(s.toUtf8());
sock->flush();

sock->waitForBytesWritten();
while (sock->isValid() && sock->bytesToWrite() > 0);





share|improve this answer























  • See my note (5) to understand why your solution works.

    – Jens
    Mar 23 at 22:39















0














So the solution was to read the data into a byte[] and then convert using a the string constructor to a string as such:



ServerSocket ss = new ServerSocket(5000);

Socket s = ss.accept();

DataInputStream in = new DataInputStream(s.getInputStream());

byte[] b = new byte[1024];
in.read(b);

String tmp = new String(b, "UTF8");
System.out.println(b);
System.out.println(tmp);


I have no idea why, but it is the solution I arrived at. The client almost stayed the same although minor changes were made:



QString s = "This is a test string that will be sent to the server upon connectionn";

QTcpSocket *sock = new QTcpSocket;

sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);

sock->waitForConnected(5000);


do
sock->write(s.toUtf8());
sock->flush();

sock->waitForBytesWritten();
while (sock->isValid() && sock->bytesToWrite() > 0);





share|improve this answer























  • See my note (5) to understand why your solution works.

    – Jens
    Mar 23 at 22:39













0












0








0







So the solution was to read the data into a byte[] and then convert using a the string constructor to a string as such:



ServerSocket ss = new ServerSocket(5000);

Socket s = ss.accept();

DataInputStream in = new DataInputStream(s.getInputStream());

byte[] b = new byte[1024];
in.read(b);

String tmp = new String(b, "UTF8");
System.out.println(b);
System.out.println(tmp);


I have no idea why, but it is the solution I arrived at. The client almost stayed the same although minor changes were made:



QString s = "This is a test string that will be sent to the server upon connectionn";

QTcpSocket *sock = new QTcpSocket;

sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);

sock->waitForConnected(5000);


do
sock->write(s.toUtf8());
sock->flush();

sock->waitForBytesWritten();
while (sock->isValid() && sock->bytesToWrite() > 0);





share|improve this answer













So the solution was to read the data into a byte[] and then convert using a the string constructor to a string as such:



ServerSocket ss = new ServerSocket(5000);

Socket s = ss.accept();

DataInputStream in = new DataInputStream(s.getInputStream());

byte[] b = new byte[1024];
in.read(b);

String tmp = new String(b, "UTF8");
System.out.println(b);
System.out.println(tmp);


I have no idea why, but it is the solution I arrived at. The client almost stayed the same although minor changes were made:



QString s = "This is a test string that will be sent to the server upon connectionn";

QTcpSocket *sock = new QTcpSocket;

sock->connectToHost(QHostAddress::LocalHost, 5000, QIODevice::ReadWrite);

sock->waitForConnected(5000);


do
sock->write(s.toUtf8());
sock->flush();

sock->waitForBytesWritten();
while (sock->isValid() && sock->bytesToWrite() > 0);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 23 at 22:36









OhunterOhunter

936




936












  • See my note (5) to understand why your solution works.

    – Jens
    Mar 23 at 22:39

















  • See my note (5) to understand why your solution works.

    – Jens
    Mar 23 at 22:39
















See my note (5) to understand why your solution works.

– Jens
Mar 23 at 22:39





See my note (5) to understand why your solution works.

– Jens
Mar 23 at 22:39













0














(1) waitForBytesWritten may fail on Windows - better use the signal bytesWritten()



(2) The loop



while(!sock->waitForBytesWritten(3000) | 1);


looks like an endless loop to me independent of the return code from waitForBytesWritten



(3) What is the idea of waitForBytesWritten in the context of your program? It may return after the first byte written to the stream!



(4) What's the idea of



if (tmp.contains(" ")){
break;


To me, this looks like it might break after any blank received - e.g. the first blank after "This". It might as well break after several lines, depending on how much readUTF delivers (I'm not an expert in Java).



(5) readUTF expects Strings in modified UTF8 format, but Qt will not send Strings in modified UTF8 (with a leading 16 bit Integer containing the length). Thus Java will interpret the first two characters ('Th') as length and then the lottery may start - depending on these two characters, the decoding will return seemingly arbitrary results.






share|improve this answer























  • So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

    – Ohunter
    Mar 23 at 22:40











  • Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

    – Jens
    Mar 23 at 22:44











  • But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

    – Ohunter
    Mar 23 at 22:46











  • UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

    – Jens
    Mar 25 at 8:42















0














(1) waitForBytesWritten may fail on Windows - better use the signal bytesWritten()



(2) The loop



while(!sock->waitForBytesWritten(3000) | 1);


looks like an endless loop to me independent of the return code from waitForBytesWritten



(3) What is the idea of waitForBytesWritten in the context of your program? It may return after the first byte written to the stream!



(4) What's the idea of



if (tmp.contains(" ")){
break;


To me, this looks like it might break after any blank received - e.g. the first blank after "This". It might as well break after several lines, depending on how much readUTF delivers (I'm not an expert in Java).



(5) readUTF expects Strings in modified UTF8 format, but Qt will not send Strings in modified UTF8 (with a leading 16 bit Integer containing the length). Thus Java will interpret the first two characters ('Th') as length and then the lottery may start - depending on these two characters, the decoding will return seemingly arbitrary results.






share|improve this answer























  • So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

    – Ohunter
    Mar 23 at 22:40











  • Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

    – Jens
    Mar 23 at 22:44











  • But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

    – Ohunter
    Mar 23 at 22:46











  • UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

    – Jens
    Mar 25 at 8:42













0












0








0







(1) waitForBytesWritten may fail on Windows - better use the signal bytesWritten()



(2) The loop



while(!sock->waitForBytesWritten(3000) | 1);


looks like an endless loop to me independent of the return code from waitForBytesWritten



(3) What is the idea of waitForBytesWritten in the context of your program? It may return after the first byte written to the stream!



(4) What's the idea of



if (tmp.contains(" ")){
break;


To me, this looks like it might break after any blank received - e.g. the first blank after "This". It might as well break after several lines, depending on how much readUTF delivers (I'm not an expert in Java).



(5) readUTF expects Strings in modified UTF8 format, but Qt will not send Strings in modified UTF8 (with a leading 16 bit Integer containing the length). Thus Java will interpret the first two characters ('Th') as length and then the lottery may start - depending on these two characters, the decoding will return seemingly arbitrary results.






share|improve this answer













(1) waitForBytesWritten may fail on Windows - better use the signal bytesWritten()



(2) The loop



while(!sock->waitForBytesWritten(3000) | 1);


looks like an endless loop to me independent of the return code from waitForBytesWritten



(3) What is the idea of waitForBytesWritten in the context of your program? It may return after the first byte written to the stream!



(4) What's the idea of



if (tmp.contains(" ")){
break;


To me, this looks like it might break after any blank received - e.g. the first blank after "This". It might as well break after several lines, depending on how much readUTF delivers (I'm not an expert in Java).



(5) readUTF expects Strings in modified UTF8 format, but Qt will not send Strings in modified UTF8 (with a leading 16 bit Integer containing the length). Thus Java will interpret the first two characters ('Th') as length and then the lottery may start - depending on these two characters, the decoding will return seemingly arbitrary results.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 23 at 22:37









JensJens

4,41811736




4,41811736












  • So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

    – Ohunter
    Mar 23 at 22:40











  • Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

    – Jens
    Mar 23 at 22:44











  • But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

    – Ohunter
    Mar 23 at 22:46











  • UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

    – Jens
    Mar 25 at 8:42

















  • So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

    – Ohunter
    Mar 23 at 22:40











  • Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

    – Jens
    Mar 23 at 22:44











  • But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

    – Ohunter
    Mar 23 at 22:46











  • UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

    – Jens
    Mar 25 at 8:42
















So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

– Ohunter
Mar 23 at 22:40





So you are saying that if I were to prepend the length of the string to a byte array containing the length that would solve it you think?

– Ohunter
Mar 23 at 22:40













Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

– Jens
Mar 23 at 22:44





Depending on your strings, readUTF might deliver unexpected results, e.g. the coding of nul and supplementary characters is different in Qt.

– Jens
Mar 23 at 22:44













But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

– Ohunter
Mar 23 at 22:46





But isn't the characterset of UTF standard so by using the QString method toUtf8() that should be avoided no?

– Ohunter
Mar 23 at 22:46













UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

– Jens
Mar 25 at 8:42





UTF is standardized, but readUTF doesn't read standardized UTF8 but instead "modified UTF8". Just google the term or read the interface description of Java here!

– Jens
Mar 25 at 8:42

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316424%2fdata-isnt-transmitted-between-qtcpsockets-and-java-sockets%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현