Ideally i would like to use this model but im having difficulty, i spent ages fiddling with the code til I realised that I cannot do it this way, im annoyed though, is there a way in which this will work?
The pseudo code is pseudo code and doesn't tell me why what you're trying to do doesn't work. Which brings me back to this point in your OP:
I realised that I cannot do it this way
What made you come to that conclusion? Please elaborate. "It doesn't work" or similarly vague descriptions do not tell us anything about what's going wrong and makes it hard/impossible to diagnose the problem.
I can only surmise that you're having a threading issue/race condition due to not putting accesses to your socket behind a mutex. But I don't know if you're actually doing that or if you just omitted it from the pseudo-code because it's pseudo-code.
So yeah.. .when having a problem.... it really helps to post actual broken code. And to explain exactly why you think it's broken. Otherwise I just have to make all sorts of guesses and assumptions.
devon we know it's broken, but just because you have pseudo code doesn't mean anything.
We know what you want to do from it, but we can't just magically know what your source code looks like.
If you're declaring the variable inside a function, then you can't use it inside another. If you want your variable to be used inside of another function, then you must make it global.
I arghh brain is so fried, cant even articulate, but yeh its some kind of recieving and sending in a thread causing issues somehow even with mutexes,
but my code is identicle to that pseudo code, everything else is flak.
I have this basic code, it gets further than my other one does, but i used this to study the irc protocol, this gets so far then stops, right before joining to a new thread.
whats going wrong here exactly, i believe i will gain the necissary insight from the answer, despitet the codes not being the same
theres locks for now but no threads, sry but the code is impossible to slice up, the send and recieve sockets are in an experimental place, your right tho' should have given the code to start with but, the code is so big, cutting it wont help that much because a lot wud be out of context, so theres a link to the whole project :/