Have I missed something I have to take in consideration when I�m starting a new Thread within the event-dispatching thread? Looks OK. Though this can open up a can of worms. By starting a separate thread you're allowing the event handling thread to do other things before the server has completely started - which sounds good. But it also may complicate things. What if the user decides to hit "stop" now while the server is still starting? Depending on how you set things up, this may be OK, or it may result in an ubly stack trace on your screen. There are certainly ways to deal with this, but you may find that things can get more complicated than you realized at fist. May not be worth the effort to go down this road.
If you
do stick with the start-a-separate-thread paradigm, you may want to consider enabling and disabling controls as approriate. Initially Connect can be enabled and Stop disabled; once Connect is pressed once, disable it immediately. Once the connection is completed, enable Stop. In between, you can call
to make things look nice.
One other thing to consider: is threadAlive accessed by any other threads? If it's only accessed from the event handling thread, you're fine. But if not, you need synchronization to access it safely.
2. Before the server shuts down, do you have an alerting procedure for the clients connected to the server? No. I think that's one of those things that would be great in the real world, but is outside the bounds of this assignment, and too much work to implement. The provided API defines all the things you need for a client to be able to get from the server.
Port numbers: I found that , on Windows XP and 2000 Pro at least, I could connect using port numbers as low as 1 or as high as 65535. Dunno if that works on all other systems, but I figure the server admin can decide what port to run on, based on what makes sense for that system. So I allowed anything in this range.
[ November 18, 2003: Message edited by: Jim Yingst ]