Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Socket...client disconnect

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
Im using a TServerSocket on one machine and multiple ClientSockets on other machines. When a Client Socket disconnects, I need to know which one disconnected.

I can't do something like send a message when the Client Socket disconnects on the client machine, because if there are errors that disconnect the client, or the program is shut down improperly, it will not send an error.

What I'm ending up doing is sending a message to all connections trying to find which one fell out and then adjust accordingly. But this isn't doing it, at least not the way i made it. Its slow, tedious and prone to many errors. Is there a way to find the user that disconnected? Or a function? Does anyone have code on how to do this? I'm dead stuck on this one.
Thanks alot, Cyprus
 
I downloaded and tried the components, and they're great! But my problem is that I've already written thousands of lines of code hard-wired to the ServerSocket and ClientSocket components. If I changed now I might as well scrap the ntire program and restart, which I definately cant do. Do you have any, (theoretical, even) suggestions about how I would do this? any Ideas? I'm open to anything Cyprus
 
My way of working now (and I had to learn it) is to put special functions in seperate units so that they are easy to use again. The moment I changed the ftpclient I just had to change the unit that encapsulated this client and I kept the interfaces to it the same (so you have to make the interfaces generally). In the beginning it seems a lot of work more but when you do it and afterwards you reuse a module without having to code everything again it is a pleasure.
I know this sounds like a theoretical concept (object oriented programming) , but it makes your program more independent and easier to change. Now I do not want to work another way. I had a problem with the Borland ftp-client (it hang the program after time outs) but as soon as I found the modules of FPiette I could test it out on smaller programs and afterwards integrate it in my bigger program with not much effort. Wim Vanherp
Wim.Vanherp@myself.com
 
Another idea :


make a seperate unit (or even a component) and take the same functionnames and properties of the component of Borland but use the new component instead to do the job.



Wim Vanherp
Wim.Vanherp@myself.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top