🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Multiple serversockets in a single executable?

#2335
From: Arska
Date: Thu, 04 May 2006 12:48
66 lines
2604 bytes
My previous post is maybe difficult to understand correctly.

This is how it should be:

----------------------------------------------------------------------------
---------------------
 void __ fastcall TForm1:: ServerSocketCliedRead( TObject *TSender,
 TCustomWinSocket *Socket)

 {
 AnsiString buf;
       ...
       buf = Socket->ReceiveText();
       .. some stuff
      Socket->SendText(" blaa blaa")
//or
      Answer(Socket->SocketHandle); // example subroutine

 }

----------------------------------------------------------------------------
-------------------------- 
void Answer(int Handle)
   {
       int i;

         for(i=0;i<ServerSocket->ActiveConnections;i++)
              if(ServerSocket->Socket->Connections[i]->SocketHandle ==
Handle;
                    ServerSocket->Socket->Connections[i]->SendText("blaa
blaa");

    }

----------------------------------------------------------------------------
---------------------------


and this was how I have wrote it. The basic idea was to send answer to right
client, but it is obviously already known.
Outside event handler ServerSocket->Socket works, but inside you have to use
Socket passed in a function call.

void __ fastcall TForm1:: ServerSocketCliedRead( TObject *TSender,
 TCustomWinSocket *Socket)

 {
 AnsiString buf;
          ...
          if(ServerSocket->Socket->Connections[X]->SocketHandle ==
User[n].SocketHandle()
         buf = Socket->ReceiveText();

               ServerSocket->Socket->Connections[X]->SendText(" blaa blaa")
          }

Thanks for all that were interested for helping.


 Arska





 Arska
Technical Details
Message-ID: <4459f802@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <444f28ce@newsgroups.borland.com> <4459d0fc$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3bf6510caf6f0f0e
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Arska" <joku@eiolemassa.fi>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <444f28ce@newsgroups.borland.com> <4459d0fc$1@newsgroups.borland.com>
Subject: Re: Multiple serversockets in a single executable?
Date: Thu, 4 May 2006 15:48:01 +0300
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807
NNTP-Posting-Host: 130.188.112.160
Message-ID: <4459f802@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1146746882 130.188.112.160 (4 May 2006 05:48:02 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail