RE: UDP/TCP SERVER ?
- Posted by Ray Smith <smithr at ix.net.au> Jan 15, 2002
- 422 views
Renzo Beggia wrote: > 1. when the client disconnects , the server should stay active untill > another connection occures (from another PC or from the same client PC) >From memory the example in euTcp4u acts like this because that is the "simple" way that I programmed the example. The euLibnet example chat server continues running until the user presses escape. This is I assume what you wanted? The chat server example in euTcp4u "could" have been programmed the same way. The examples are just that, simple examples. By writing your own program that uses the library you can pretty much achieve anything you want. > 2.The server should stop sending the text to the client when the client > has > disconnected . (in all the examples i found , the server kept on sending > to > clients who had already logged out) The chat server example in euTcp4u stops when a "q" or "Q" is sent from the client. After a quick look it looks like euLibnet server example does keep sending messages to disconnect clients. I'm not sure of the best method of overcoming this right now. Maybe every "n seconds" you could send a "are you still alive" message. If the client doesn't respond within a "timeout" period of seconds you assume the connection has been lost? There probably are better ways but I don't know without doing some research. Saying that, I'm sure you could programatically find a resonable solution for the problem. > Can someone help me end maybe send me some code, because the chat > servers i > found, seem to be a bit difficult for me. If you can't follow the code in the example chat servers in euLibnet and euTcp4u I don't think you will be able to write the program you want to. My suggestion is (if you want to use euLibnet or euTcp4u) is to play with the example programs. Make small changes to the examples. Then start by writing you own simple client/server program. Start with a really simple program that just accepts connections and sends simple messages. Once you understand the basic structure of how to use the libraries you should have no problems writing the program you want. Also read the doco that comes with both libraries as it describes in detail what each function does. Ray Smith http;//www.geocities.com/ray_223