Board index » delphi » INDY TCP Client/Server Question
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 13:02:13 GMT
|
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 13:02:13 GMT
INDY TCP Client/Server Question
Can anyone tell me how to go about setting up a conversation between a
client and server using the same socket connection? i.e.: I want to be able to initiate a conversation from either side without Can this be done? -- |
Ido de Leppe
![]() Delphi Developer |
Mon, 24 May 2004 16:49:39 GMT
Re:INDY TCP Client/Server QuestionHi Well the the main difference between a Server and a Client is that the Server Once you have a Server -- Client connection both can send data to one and other Hope this short description helps! Cheers Ido |
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 22:06:59 GMT
Re:INDY TCP Client/Server QuestionI do appreciate your answer, but it doesn't help much. I understand how to initiate the conversation but I don't understand how both can listen at once. There seems to have to be a protocol between the two systems as far as the conversation goes. How can both systems sit there and listen, but still be able to talk at the same time? This might be a bad example, but it does provide a little insight as to why Am I missing something? Thanks, -- Quote> Hi |
Ido de Leppe
![]() Delphi Developer |
Mon, 24 May 2004 22:39:23 GMT
Re:INDY TCP Client/Server Questionmm, ok I get the confussion. There are 2 things that are happening, 1) connecting, and 2) communication 1)Connecting 2)Communication between Server&Client and Client&Server Also take in mind that after the Client has connected to the Server either party Hope this is better? Cheers Ido |
Ido de Leppe
![]() Delphi Developer |
Mon, 24 May 2004 22:44:34 GMT
Re:INDY TCP Client/Server Questionps, about the icq example, icq is peer 2 peer, so each icq application is a Server + Client all rolled into one. When sending data from your icq to a buddy you connect to the buddys local icq server. But if he is behind a firewall he cant start a server so everything goes via the main ICQ server. If your buddy sends you something he connects to your local icq server with his icq client. Try to look up some info about peer2peer communication! Cheers |
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 22:57:24 GMT
Re:INDY TCP Client/Server Questionwill do on the Peer-to-Peer stuff, but I'll give you my problem in a nutshell. On the server after the client connects, I have to get the server to wait Athread.connection.readln; The entire thread stops until that client sends something. That means that Thanks, -- Quote> ps, about the icq example, icq is peer 2 peer, so each icq application is |
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 23:23:56 GMT
Re:INDY TCP Client/Server QuestionAlso I could be wrong, but I think that ICQ attaches to a server and forwards your messages through that server out to the member you wish to communicate with. All messages go to the server IP not to individual IP addresses. If that were the case if I had 50 people in my icq list, I would have to have 50 different connections to manage versus 1 with the ICQ server. I am pretty sure thats how it works anyway... -- Quote> ps, about the icq example, icq is peer 2 peer, so each icq application is |
Glenn Hancoc
![]() Delphi Developer |
Mon, 24 May 2004 23:29:58 GMT
Re:INDY TCP Client/Server QuestionPeer-to-Peer, I have been reading up on Peer-to-Peer since you suggested it was the So I guess my question stays: How do they do it? How do they have a Thanks, -- Quote> ps, about the icq example, icq is peer 2 peer, so each icq application is |
Al Kir
![]() Delphi Developer |
Tue, 25 May 2004 00:03:53 GMT
Re:INDY TCP Client/Server QuestionUse non-blocking sockets opened for reading and writing. Investigate ICS components. QuoteGlenn Hancock wrote: |
Martin Jame
![]() Delphi Developer |
Tue, 25 May 2004 03:15:07 GMT
Re:INDY TCP Client/Server QuestionQuoteGlenn Hancock <ghanc...@softeksupport.com> wrote in message Quote> Peer-to-Peer, write to the client while another is blocked waiting. I do this all the time in my servers - I can type 'DIR' in both client & server terminal windows, press return on both & see a listing of each other's directory appear 'simultaneously'. You just need a suitable protocol and threads. Or, if you're really Rgds, |
Glenn Hancoc
![]() Delphi Developer |
Tue, 25 May 2004 05:49:52 GMT
Re:INDY TCP Client/Server QuestionSo its ok then to have 2 different connections to the server for each client? One to read and the other to write. This seems the simplest approach but I wanted to make sure it was the best approach and I wasn't wasting resources. I have this approach working but after seeing what ICQ was doing, it made me wonder if I was missing something. Thanks, -- Quote"Martin James" <james...@nortelnetworks.com> wrote in message Quote
|
Michael Winte
![]() Delphi Developer |
Tue, 25 May 2004 06:44:28 GMT
Re:INDY TCP Client/Server QuestionGlenn Hancock schrieb: Quote> On the server after the client connects, I have to get the server to wait use another thread to send from. Usually the Peer thread created by the Indy server automatically on accept is used to ReadLn. In that case, simply call WriteLn from the main thread context or from a third one. -Michael |
Michael Winte
![]() Delphi Developer |
Tue, 25 May 2004 06:51:47 GMT
Re:INDY TCP Client/Server QuestionGlenn Hancock schrieb: Quote
One client - one connection. One server - multiple connections. From the POV of one side, reading and writing at the same time using the Compare with _one_ telephone line where both partners speak -Michael |
Glenn Hancoc
![]() Delphi Developer |
Tue, 25 May 2004 07:57:49 GMT
Re:INDY TCP Client/Server QuestionOk, Just so I understand... I have 1 client and 1 server. The client kicks off a connection to the Now, the process that spawned the thread to communicate with the client, Here is where I am confused. With a single writeln from the client to the The more I go into this, the more I find it impossible to do cleanly. Maybe Thanks, -- Quote"Michael Winter" <delphi....@gmx.net> wrote in message Quote> Glenn Hancock schrieb: |
Al Kir
![]() Delphi Developer |
Tue, 25 May 2004 08:20:46 GMT
Re:INDY TCP Client/Server QuestionWhat you want CAN be done with INDY and blocking sockets, by creating threads and using the created thread on each end to perform the opposite function with the same socket ( the sockets are opened for both reading and writing). With non-blocking sockets that are opened for reading and writing, you receive an event when there is something to read, and an If you have app/server where logic dictates that data flows in sequence: a-->b Then blocking sockets make it slightly easier to code. If you have an app/server where data can flow in either direction at any time, or maybe one direction mutiple times, then I prefer Quote
|
1. Indy TCP Client / Server question
2. Indy TCP Server slows down when clients connect (Indy Newbie)
4. Indy TCP Client / Server WriteFile Problem
5. Indy TCP Client Server suggestion, please!
6. INDY TCP Server cant get Client IP
7. INDY TCP/IP Client an Server at the same time for the same IP
8. Help with Indy TCP client/server PLZ!