c++ - Why can't I send data with QTcpSocket's write() method? -


i'm trying learn qt documentation alone, , it's kind of tough. managed simple command-line chat client working, don't know how send things. takes 4 lines of intuitive code read socket in qt, reason can't say

qtcpsocket socket; socket.connecttohost("google.com", 80); socket.write("hey"); socket.flush(); 

flush(); returns false, don't see why.

i don't understand why doesn't work , appreciate help. thanks!

after calling connecttohost() need have slot handler connected() or call waitforconnected() wait connection host complete otherwise code zooming right through trying write before connection established.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -