🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Server and Client Sockets

#3417
From: Hans Galema
Date: Sat, 01 Oct 2005 10:59
33 lines
2314 bytes
Paul wrote:

> I'm setting the socket type to nonblocking, is this the problem, should non 
> blocking components be used in threads? 

Yes. You cannot use nonblocking in a thread as that depend on events triggered
from a message queue. There is no such queue in your thread. But you could
add such a loop I think.

> And I'm passing NULL in the 
> constructor parameter for the component, does anyone know what this is used 
> for, 

As usual the -vcl-owner will delete that component when it is deleted
itself. If you pass NULL then your component should delete it in the
destructor. If you pass 'this' then it will be deleted automatically
provided that OwnerMbx is a vcl object.

>     if (AsServer)
>     {
>         // create TCP Server Socket, with default parameters
>     }
>     else
>     {
>         // create TCP Client Socket, with default parameters
>     }

Seeing that you make one class that can behave both like server
and client I shiver. I have done such things too but now my opinion
is that live is much easier having two classes. Maintainability
of code only for a server and only for a client is much easier then.

Hans.
Technical Details
Message-ID: <433e6bce$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeeder.wxs.nl!eweka!lightspeed.eweka.nl!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <433e524d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,dc3706a89a245de9
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sat, 01 Oct 2005 12:59:41 +0200
From: Hans Galema <notused@notused.nl>
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: Re: Server and Client Sockets
References: <433e524d$1@newsgroups.borland.com>
In-Reply-To: <433e524d$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 145.98.201.248
Message-ID: <433e6bce$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1128164302 145.98.201.248 (1 Oct 2005 03:58:22 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeeder.wxs.nl!eweka!lightspeed.eweka.nl!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail