Unresolved External Symbol....I'm getting this error: LINK2019 Unresolved External Symbol in my exercise code. I actually try to implement it from a youtube video and i'm still getting this error.
-
@SGaist thanks
so how does that work !! and whats the flow of the whole sending and receiving functions or Signals and slots for client socket !
should I create ready read, byteswritten and addPendingConnection of my own or should I just call those signals and attach them to the function or slots that I'd create!!?
-
When you declare a slot, you have to implement it otherwise you have missing code.
moc
generates code that will use that slot.Did you read the Signals And Slots chapter of Qt's documentation ?
-
What do you mean by flow ?
-
@SGaist What I mean is, as for readyRead(): This signal is emitted once every time new data is available for reading... So does it mean that once i connect this signal to the slot I created to read or Receive data would get called every time when someone sends data!!?
now bytesWritten(qint64 bytes): This signal is emitted every time a payload of data has been written to the device's current write channel....So should I consider that if I connect this signal to the slot which sends data from my side it will get called every time !!?
my code puts me in the blocking mode sometimes. and whats the best way to connect signal from one class to the slot of some other class !!
thanks in advance @SGaist and anyone who responses back.
-
It will be called every time new data has arrived which might not be exactly when your device sends it (depending on the speed of the channel, system load, application load etc.) Usually you won't see any delay but it's not instantaneous.
That's the goal of signals and slots, once connected the slots are getting called each time a signal is fired.
What do you mean by "puts me in the blocking mode" ?
The best way is to do the connections in the class that manages these two objects.
-
@SGaist the code I've posted above , I've added a few more slots and functions in it. so when I'm asking a client to enter its ID from server side ...server is supposed to read when there's something to read, instead it reads nothing when client actually sends its ID and then at second attempt server reads it....and now my client is in blocking mode as it can't read or write .
now if I remove this asking for ID function "readClientID() " from server side, client and server both works fine .when I debugged the server side, I found that sometimes when client sends its ID, readyRead() signal triggers and it calls the slot which actually receives data instead the function which actually reads ID. I have a signal which is emmited everytime new client comes and that signal is connected to readClientID.
-
From the looks of it, you are expecting to get all of your data at once when
readyRead
is fired which likely won't happen especially when using TCP. You have to establish a protocol to ensure you got all the data you are expecting or using something like QDataStream transactions.