🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Help using sockets.....

#4107
From: Paul
Date: Wed, 06 Apr 2005 17:48
31 lines
2152 bytes
Right.  I've tried the tutorial and I get the same 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();

Can I confirm:
The client app component (drag + drop onto the form) is "ctNonBlocking"?
The server app component (drag + drop onto the form) is "stThreadBlocking"
and has an event handler for get thread.

//--------------------------------------------------------------------------
-
void __fastcall TForm1::ServerSocket1GetThread(TObject *Sender,
      TServerClientWinSocket *ClientSocket, TServerClientThread
*&SocketThread)
{
   SocketThread = new TMyServerThread(false, ClientSocket);
}
void __fastcall TForm1::SocketOpenClick(TObject *Sender)
{
    // open thread blocking socket
    ServerSocket1->Active = true;
}
void __fastcall TForm1::SocketCloseClick(TObject *Sender)
{
    // close thread blocking socket
    ServerSocket1->Active = false;
}
Technical Details
Message-ID: <42542096$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <425388a2@newsgroups.borland.com> <425396df$1@newsgroups.borland.com> <4254080d$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
Reply-To: "Paul" <plmacca@clara.co.uk>
From: "Paul" <plmacca@clara.co.uk>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <425388a2@newsgroups.borland.com> <425396df$1@newsgroups.borland.com> <4254080d$1@newsgroups.borland.com>
Subject: Re: Help using sockets.....
Date: Wed, 6 Apr 2005 18:48:44 +0100
Lines: 33
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: 81.129.159.104
Message-ID: <42542096$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112809622 81.129.159.104 (6 Apr 2005 10:47:02 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail