🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9878

Re: Imitating Telnet

#9878
From: Remy Lebeau (TeamB)
Date: Fri, 11 Jun 2004 22:05
51 lines
2484 bytes
"Feico" <feicorem0veth1s@gmx.net> wrote in message
news:ca9kc0pg43rmc29o9t346a4atb3ko8s7n8@4ax.com...

> Where to obtain it?

BCB ships with several already, such as TClientSocket.  Or if you get Indy
(ships with BCB6 and is also downloadable from http://www.indyproject.org),
it has components that are specific to the POP3 and SMTP protocols.  So does
ICS (http://www.overbyte.be).

> And you give me an example of a 30 line program,
> while I had expected something as simple as
> handle = connect(char*domain, int port);

Nope.  Socket programming is not that simple.  If you use higher level
components, however, then they can hide much of the details from you and
reduce the amount of our own coding.

> This produces HostAddr==0. Could that be right?

Change this line:

    HostAddr = inet_addr(pHost->h_addr);

To this instead:

    HostAddr = ((in_addr*)&pHost->h_addr).s_addr;

> >            if( sock )

Change that line to this instead:

    if( sock != INVALID_SOCKET )

> This fails, it says 10047, Address family not supported by protocol
family.

Add this line before calling connect():

    addr.sin_family = AF_INET;

> So I try to write the program myself. I need functions to do things.

Then I suggest you use pre-made components and save yourself the trouble of
implementing everything yourself manually.  Why re-invent the wheel,
afterall?  There are plenty of libraries readily available that already do
all of the hard work for you.


Gambit
Technical Details
Message-ID: <40ca2dc2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <mk4kc0lf2ku8qbgk2n98eav00l9b0552u5@4ax.com> <40ca1c3f$1@newsgroups.borland.com> <ca9kc0pg43rmc29o9t346a4atb3ko8s7n8@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6ff98bec32bcdef
X-Google-Attributes: gid10cc67,public
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <mk4kc0lf2ku8qbgk2n98eav00l9b0552u5@4ax.com> <40ca1c3f$1@newsgroups.borland.com> <ca9kc0pg43rmc29o9t346a4atb3ko8s7n8@4ax.com>
Subject: Re: Imitating Telnet
Date: Fri, 11 Jun 2004 15:05:46 -0700
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.169.168.124
Message-ID: <40ca2dc2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1086991810 68.169.168.124 (11 Jun 2004 15:10:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail