🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3278

Re: TIdTCPClient/TIdTCPServer communication

#3278
From: Vladimir Stefanovic
Date: Tue, 04 Oct 2005 17:36
45 lines
2591 bytes
>> Can someone show some working code?
>
> A better thing to do would be for you to show your
> original TClient/ServerSocket code so that someone
> can then show you how to translate it into Indy code.

Hi,


This is one of the imaginary scenarios that I want to
port to Indy.

1) CLIENT: Sends request (buffer of data) to SERVER
2) SERVER: Receives request (buffer of data) from CLIENT
3) SERVER: Processes the received buffer of data and
prepares a response
4) SERVER: Sends response to CLIENT of the processing success
5) CLIENT: Receives response from SERVER and shows the message

For example, this should check if the file exists on the server
machine (by the logic of TClintSocket/TServerSocket):

1) CLIENT SENDS BUFFER: buffer_size ASK C:\Autoexec.bat
2) SERVER RECEIVES BUFFER: ASK C:\autoexec.bat
3) SERVER RESOLVES 'ASK' COMMAND AND SERACHES FOR FILE:
FileExists("C:\\autoexec.bat)" AND PREPARES RESPONSE
4) SERVER SENDS BACK BUFFER: buffer_size MSG File exists!
5) CLIENT RECEIVES BUFFER: MSG File exists! and shows the
message "File 'autoexec.bat' exists on server machine".

This is how whould I do it with TServerSocket/TClientSocket
(CLIENT: ctNonBlocking, SERVER: stThreadBlocking):

[I attached Both CLIENT&SERVER CODE & EXE's in the
Attachments group]

I wanted to place the code directly here but unfortunately,
the working code appeared to be too big for the message body.
If you still think that I should place it here, I'll do that.



-- 
Best regards,
Vladimir Stefanovic 
Technical Details
Message-ID: <4342bd1b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <433cd755@newsgroups.borland.com> <433cda46$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,6817d6944e9bb7ca
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <433cd755@newsgroups.borland.com> <433cda46$1@newsgroups.borland.com>
Subject: Re: TIdTCPClient/TIdTCPServer communication
Date: Tue, 4 Oct 2005 19:36:27 +0200
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.117.212.65
Message-ID: <4342bd1b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1128447259 82.117.212.65 (4 Oct 2005 10:34:19 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail