Clear questions and runnable code
get the best and fastest answer
Re^3: How to do simultaneous reads and writes to/from a socket?by BrowserUk (Pope)
|on Oct 12, 2007 at 10:06 UTC||Need Help??|
the codes have not worked for me .
Oh? How can you tell? What errors did you see?
but as i see it's just a server that excepts more then 1 client. am i wrong?
Well actually, it is both client and server all in a single program. This bit (as suggested by the comment) is a multi-threaded, asynchronous, bi-directional server:
And this bit (again, the comment), is a non-blocking bi-directional client with asynchronous keyboard input.
The point of the code is to demonstrate how to achieve asynchronous, bi-directional communications via a single socket. You are then supposed to take that code and use it to understand the way it works and then adapt it to your particular requirements. So far, as far as I have seen in your last two threads, you haven't yet even defined what your requirements are. That's often a sign that you aren't really sure what it is that you want in the first place.
Several people posted code in you other thread and you seemed to just say that it didn't work for you. Given that I know the quality of the code posted by guys like zentara and others, I know that they don't post non-working code, so the question is why doesn't it work for you?
For example. Are you looking to allow just two people to talk to each other point to point, or are you looking for something more elaborate?
So, until you define more clearly what kind of chat program you are trying to write, and demonstrate some propensity to trying to understand the posted code and adapt it to your requirements, it looks very much to me like you are hoping someone will just write the code for you. And if that is the case, why not just download one of the dozens of free IM and IRC programs available and use that?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.