🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Indy10 usage

#481
From: Mike Ruskai
Date: Tue, 04 Mar 2008 16:16
33 lines
2239 bytes
I have an application which uses Unix-style socket calls, to which I'm
attempting to add SOCKS support.

Indy supposedly supports SOCKS, so I'm trying to figure out how to
convert the normal socket code to the bizarre usage of Indy.

I'm using BCB6 for the app in question, so I removed Indy 8,
downloaded the latest Indy10 snapshot, and installed that (apparently
successfully).

Since the high-level protocol in use is proprietary, I'm using
TIdTCPClient.  I'm assigning a TIdIOHandlerStack to the IOHandler
property, and a TIdSocksInfo to the TransparentProxy property of the
IOHandler (though I've also tested with no proxy set - results are the
same).

One problem is that there's no simple functional equivalent of recv()
for the IOHandler.

I've tried ReadBytes() and ReadLn(), preceded by Readable() to make
sure the socket can be read (that functionality is a must), just to
get started on simply reading any data from the socket.

I connect to a server I control, which sends data over the socket as
soon as it's connected.  I've confirmed with packet capture that the
correct data is sent.

However, while Readable() returns true, both ReadBytes() and ReadLn()
read nothing at all.  The Length property of the TDynByteArray sent to
the former is 0, and the return string for the latter is empty.  Yet
calling them made the result of Readable() subsequently false.

What is the correct way to simply read and write a socket?
Technical Details
Message-ID: <ghsqs35tipni65rjlntjpl7hgi6f1bv1g8@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ea086d952e8cb041,start
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Mike Ruskai <BUTthannydI@DONTearthlinkLIKE.netSPAM>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Indy10 usage
Date: Tue, 04 Mar 2008 11:16:45 -0500
Message-ID: <ghsqs35tipni65rjlntjpl7hgi6f1bv1g8@4ax.com>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.41.244.203
X-Trace: newsgroups.borland.com 1204647401 65.41.244.203 (4 Mar 2008 08:16:41 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail