 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
AntonE Guest
|
Posted: Sat May 19, 2007 12:58 am Post subject: TCPserver/client update advice |
|
|
I've written my FIRST TCPserver/client program! (D6.2 ent, Indy10)
It is a network (multiple) calendar program that users update all the time
for doctors offices. It must run over the Internet(ADSL) for multiple
branches.
My TCPserver/client talks are strictly 'conversational', meaning the client
WriteLN a request & then knows what to expect in return. All good so far...
Now I want to tell all clients connected to the server if an appointment
have been added/edited/deleted as well as other stuff in the app, like
messages/notes. I do not want to have every client readln check for a
possible 'random' response from the server, so my first thought was to
create another TCPserver instance in the server-prog (port+1) and use that
exclusively for sending client messages, like 'mail arrived' or 'appointment
added' or whatever.
Out of this flows 3 questions:
1) Is it adviceable to do it in this way, then on the client have a thread
running with a TCPclient that constantly check every for a 'message' from
the server?
2) How do I thread-synchronize TCPserver/client stuff, like updating the
interface as the docs & samples I have is for Indy9 with a AThread variable
that is easily accessable?
3) How do I find all TCPserver connections so I can send a WriteLN to each
connected client?
Thanks everyone
AntonE
(Once you get it going) Indy rocks! |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat May 19, 2007 2:04 am Post subject: Re: TCPserver/client update advice |
|
|
"AntonE" <antone (AT) true (DOT) co.za> wrote in message
news:464e05ff (AT) newsgroups (DOT) borland.com...
| Quote: | I do not want to have every client readln check for a
possible 'random' response from the server
|
Since you don't know when a server will send a message, your client
will have to check for random inbound messages. If you go to
http://www.deja.com and search through the newsgroup archives,
examples of implementing and processing asynchronous server->client
notifications have been posted before.
| Quote: | my first thought was to create another TCPserver instance in the
server-prog (port+1) and use that exclusively for sending client
messages, like 'mail arrived' or 'appointment added' or whatever.
|
That would be a viable alternative.
| Quote: | Is it adviceable to do it in this way, then on the client have a
thread
running with a TCPclient that constantly check every for a 'message'
from the server?
|
You would have to do that regardless of which approach you take. The
only difference is, if you keep your current architecture (using a
single connection), then you would have to change the way you process
responses to commands you send, since the reading thread, not the
sending thread, would be the thread that picks up the responses. In
which case, you would likely have to add an ID number to your commands
so that the reading thread can differentiate between command responses
and server-issued commands.
| Quote: | How do I thread-synchronize TCPserver/client stuff, like updating
the interface as the docs & samples I have is for Indy9 with a
AThread variable that is easily accessable?
|
Use the TIdSync class. Again, many examples have been posted before.
Search the archives.
| Quote: | How do I find all TCPserver connections so I can send a WriteLN
to each connected client?
|
The same way you do in Indy 9. In Indy 10, the Threads list in
TIdTCPServer.has been replaced with the Contents list, and the
TIdPeerThread class replaced with the TIdContext class. Beyond that,
the logic of looping through the active connections is the same.
Gambit |
|
| Back to top |
|
 |
AntonE Guest
|
Posted: Sat May 19, 2007 3:06 am Post subject: Re: TCPserver/client update advice |
|
|
| Quote: | http://www.deja.com and search through the newsgroup archives,
Search the archives.
|
I will go have a look there, thanks. |
|
| Back to top |
|
 |
AntonE Guest
|
Posted: Sat May 19, 2007 3:08 am Post subject: Re: TCPserver/client update advice |
|
|
| Quote: | http://www.deja.com and search through the newsgroup archives,
|
That link takes me to google groups main login... Is it just me? |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat May 19, 2007 3:48 am Post subject: Re: TCPserver/client update advice |
|
|
"AntonE" <antone (AT) true (DOT) co.za> wrote in message
news:464e23bc (AT) newsgroups (DOT) borland.com...
| Quote: | http://www.deja.com and search through the newsgroup archives,
That link takes me to google groups main login...
|
That is what it is supposed to do. Google bought out Deja a few years
ago. But the Deja domain still works, and I find it easier to type
and remember then Google's direct link.
Gambit |
|
| Back to top |
|
 |
AntonE Guest
|
Posted: Sat May 19, 2007 10:40 pm Post subject: Re: TCPserver/client update advice |
|
|
| Quote: | my first thought was to create another TCPserver instance in the
server-prog (port+1) and use that exclusively for sending client
messages, like 'mail arrived' or 'appointment added' or whatever.
That would be a viable alternative.
|
As I send binary data and not just text strings, I think that it will be the
way to go.
Thanks for the advice/help.
AntonE |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|