🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #227

C# to Delphi tcpclient data send/receive

#227
From: Nigel Scott
Date: Sat, 22 Jul 2006 17:07
47 lines
2101 bytes
Using C3 out of  bds 2006 and Delphi7, I am having difficulty with receiving 
intelliable data in the Delphi 7 app.  (Sending the other way is 
intelliable).

    if (outStream.CanWrite)
    {
      string sendMsg = "Good Day";
       Byte[] data = System.Text.Encoding.ASCII.GetBytes(sendMsg);
       this.outStream.Write(data, 0, data.Length);
    }

From the above, the receive event contains this

procedure TForm1.TcpClient1Receive(Sender: TObject; Buf: PAnsiChar;
  var DataLen: Integer);
var
  P: PChar;
 recvdString: String;
begin
    if (Sender is TCustomIpClient) then
    begin
         P := @Buf;
        recvdString := PChar(P);
        memRecv.Lines.Add('Recd: ' + recvdString);
    end;
....
end;


The following in an onConnect event produces similar problems
var
  A: array[0..79] of Char;
  P: PChar;
  bufsize: Integer;
begin
      TCustomIpClient(Sender).ReceiveBuf(A, bufsize, 0);
      if not (bufsize = 0) then
      begin
        P := @A[0];
        recvdString := string(P);
      end;
 .....
end;

I apologize if there is a more suitable newsgroup.

Nigel Scott, MVS
Technical Details
Message-ID: <44c25b64@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,2f9b2018e28731ee,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Nigel Scott" <mvsoft@telus.net>
From: "Nigel Scott" <mvsoft@telus.net>
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: C# to Delphi tcpclient data send/receive
Date: Sat, 22 Jul 2006 11:07:42 -0600
Lines: 49
Organization: MVS
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 161.184.19.70
Message-ID: <44c25b64@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1153588068 161.184.19.70 (22 Jul 2006 10:07:48 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail