🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TServerSocket Not Receiving Data

#3170
From: Bill Cain
Date: Mon, 14 Nov 2005 18:28
169 lines
5740 bytes
I am writing an FTP client application that uses TServerSocket(as the 
data connection) in a thread other than the main VCL thread.  The 
ServerType is set to stBlockingThread.

The problem that I am encountering is that the socket does not appear to 
be accepting data received from a client after connecting to the client. 
  Accept and Connection Events are triggered but no Read Event is triggered.

The following is the capture of the LAN  traffic and the source code 
used to begin listening. The server IP is  147.19.136.111.  The server 
connection begins at packet No. 30 on port 2370.  Data is sent at packet 
No. 34.

Can you tell me why the TServerSocket is not receiving data?



No. 23
   Source        147.19.136.111
   Destination   147.16.223.200
   Protocol      FTP
   Info          "Request: PORT 147,19,136,111,9,66"

No. 24
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      TCP
   Info          "FTP > 2369 [ACK] Seq=961 Ack=92 Win=24820 Len=0"

No. 25
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      FTP
   Info          "Response: 200 PORT command successful."

No. 26
   Source        147.19.136.111
   Destination   147.16.223.200
   Protocol      FTP
   Info          "Request: TYPE A"

No. 27
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      FTP
   Info          "Response: 200 Type set to A."

No. 28
   Source        147.19.136.111
   Destination   147.16.223.200
   Protocol      FTP
   Info          "Request: NLST"

No. 29
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      TCP
   Info          "FTP > 2369 [ACK] Seq=1011 Ack=106 Win=24820 Len=0"

No. 30
   Source        199.46.200.230
   Destination   147.19.136.111
   Protocol      TCP
   Info          "40025 > 2370 [SYN] Seq=0 Ack=0 Win=24820 Len=0 MSS=1460"

No. 31
   Source        147.19.136.111
   Destination   199.46.200.230
   Protocol      TCP
   Info          "2370 > 40025 [SYN, ACK] Seq=0 Ack=1 Win=64512 Len=0 
MSS=1460"

No. 32
   Source        199.46.200.230
   Destination   147.19.136.111
   Protocol      TCP
   Info          "40025 > 2370 [ACK] Seq=1 Ack=1 Win=24820 Len=0"

No. 33
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      FTP
   Info          "Response: 150 ASCII data connection for /bin/ls
                 (199.46.200.230,39982) (0 bytes)."

No. 34
   Source        199.46.200.230
   Destination   147.19.136.111
   Protocol      TCP
   Info          "40025 > 2370 [PSH, ACK] Seq=1 Ack=1 Win=24820 Len=630"

No. 35
   Source        199.46.200.230
   Destination   147.19.136.111
   Protocol      TCP
   Info          "40025 > 2370 [FIN, ACK] Seq=631 Ack=1 Win=24820 Len=0"

No. 36
   Source        147.19.136.111
   Destination   199.46.200.230
   Protocol      TCP
   Info          "2370 > 40025 [ACK] Seq=1 Ack=632 Win=63882 Len=0"

No. 37
   Source        147.19.136.111
   Destination   147.16.223.200
   Protocol      TCP
   Info          "2369 > FTP [ACK] Seq=106 Ack=1084 Win=63429 Len=0"

No. 38
   Source        147.16.223.200
   Destination   147.19.136.111
   Protocol      FTP
   Info          "Response: 226 ASCII Transfer complete."

No. 39
   Source        147.19.136.111
   Destination   147.16.223.200
   Protocol      TCP
   Info          "2369 > FTP [ACK] Seq=106 Ack=1114 Win=63399 Len=0"

What I expect to see here is something similar to the following:

No. 40
   Source        199.46.200.230
   Destination   147.19.136.111
   Protocol      TCP
   Info          "40025 > 2370 [FIN, ACK] Seq=604 Ack=1 Win=24820 Len=0"

No. 41
   Source        147.19.136.111
   Destination   199.46.200.230
   Protocol      TCP
   Info          "2370 > 40025 [ACK] Seq=1 Ack=605 Win=63909 Len=0"






     DataSocket2->Port = ConvertPortString(PortString);
     Command = AnsiString("PORT ") + AnsiString(Addr[0]) +\
	AnsiString(",") + AnsiString(Addr[1]) +\
	AnsiString(",") + AnsiString(Addr[2]) +\
         AnsiString(",") + AnsiString(Addr[3]) + PortString;
     if(Error = DoTransaction(Command))
     {
       return Error;
     }

     if(ReplyCode == AnsiString("200")) //PORT command sucessful?
     {
       if(Error = DoTransaction(AnsiString("TYPE A")))
       {
         return Error;
       }

       if(ReplyCode == AnsiString("200")) //Type set to A?
       {
           Wait = true;
           if(!DataSocket2->Active)
           {
             DataSocket2->Open();
           }
           Writeln(AnsiString("NLST"));//List item names
           while(Wait) //Wait for LIST responses
           {
           }
        }
Technical Details
Message-ID: <4378d734$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ed98f643ba2c61e4,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 14 Nov 2005 10:28:48 -0800
From: Bill Cain <bill.ctr.cain@faa.gov>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: TServerSocket Not Receiving Data
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 199.46.253.28
Message-ID: <4378d734$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1131992884 199.46.253.28 (14 Nov 2005 10:28:04 -0700)
Lines: 170
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail