🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Help using sockets.....

#4108
From: Hans Galema
Date: Wed, 06 Apr 2005 18:00
50 lines
2629 bytes
Paul wrote:
> Right.  I've tried the tutorial and I get the same problem. 

Which problem ?

> Every time the
> server gets data it drops into the client socket close(), snippet below,
> which is in the TMyServerThread.
> 
>                if (pStream->Read(buffer, sizeof(buffer)) == 0)
>                   // (if can't read in 60 seconds) than close the connection
>                   ClientSocket->Close();

Well it should only close after 60 seconds. Can you confirm that ?
And .. If you do not want to close then don't.

> Can I confirm:
> The client app component (drag + drop onto the form) is "ctNonBlocking"?

Pleas use the right names. You mean: The TClientSocket in this example
if of type ctNonBlocking ? yes.

> The server app component (drag + drop onto the form) is "stThreadBlocking"
> and has an event handler for get thread.

TServerSocket was the name. stThreadBlocking yes.

> 
> //--------------------------------------------------------------------------
> -
> void __fastcall TForm1::ServerSocket1GetThread(TObject *Sender,
>       TServerClientWinSocket *ClientSocket, TServerClientThread
> *&SocketThread)
> {
>    SocketThread = new TMyServerThread(false, ClientSocket);
> }

> void __fastcall TForm1::SocketOpenClick(TObject *Sender)

If that is an eventhandler for a TButton then please let the name
as such when seeking help.

> void __fastcall TForm1::SocketCloseClick(TObject *Sender)
> {
>     // close thread blocking socket
>     ServerSocket1->Active = false;
  that is not enough I think.
> }

Hans.
Technical Details
Message-ID: <4254244a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <425388a2@newsgroups.borland.com> <425396df$1@newsgroups.borland.com> <4254080d$1@newsgroups.borland.com> <42542096$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b9337a02b76d7efd
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 06 Apr 2005 20:00:32 +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: Help using sockets.....
References: <425388a2@newsgroups.borland.com> <425396df$1@newsgroups.borland.com> <4254080d$1@newsgroups.borland.com> <42542096$1@newsgroups.borland.com>
In-Reply-To: <42542096$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <4254244a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112810570 129.125.201.248 (6 Apr 2005 11:02:50 -0800)
Lines: 50
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail