🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
6 messages
6 total messages Started by DreamChaser Sat, 31 May 2008 15:23
TServerClientWinSocket->Data Help Please
#141
Author: DreamChaser
Date: Sat, 31 May 2008 15:23
10 lines
1269 bytes
I am posting here instead of *.VCL.Using because I figured you guys 
would have a better understanding of my question.

Has anybody gotten TServerClientWinSocket->Data to work with storing an 
AnsiString? I got a new AnsiString() assigned to it during the 
OnClientConnect event, and it seemed to work, but I am unsure where/how 
to delete it.

Any help you can provide, as always, is appreciated.
DC
Re: TServerClientWinSocket->Data Help Please
#143
Author: Remy Lebeau (TeamB)
Date: Mon, 02 Jun 2008 16:28
25 lines
1676 bytes
"DreamChaser" <NO-Spam@No-Span.net> wrote in message 
news:48416d7a$1@newsgroups.borland.com...

> Has anybody gotten TServerClientWinSocket->Data to work with
> storing an AnsiString? I got a new AnsiString() assigned to it during
> the OnClientConnect event, and it seemed to work, but I am unsure
> where/how to delete it.

Use the OnClientDisconnect event, ie:

    void __fastcall TForm1::ServerSocket1ClientConnect(TObject* Sender, 
TCustomWinSocket* Socket)
    {
        Socket->Data = new AnsiString();
    }

    void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject* Sender, 
TCustomWinSocket* Socket)
    {
        delete (AnsiString*) Socket->Data;
    }


Gambit 
Re: TServerClientWinSocket->Data Help Please
#144
Author: DreamChaser
Date: Mon, 02 Jun 2008 16:41
32 lines
1956 bytes
You da Man...Once again :)

I knew it had to be something simple, I just wasn't getting it.
Thanks G

Remy Lebeau (TeamB) wrote:
> "DreamChaser" <NO-Spam@No-Span.net> wrote in message 
> news:48416d7a$1@newsgroups.borland.com...
> 
>> Has anybody gotten TServerClientWinSocket->Data to work with
>> storing an AnsiString? I got a new AnsiString() assigned to it during
>> the OnClientConnect event, and it seemed to work, but I am unsure
>> where/how to delete it.
> 
> Use the OnClientDisconnect event, ie:
> 
>     void __fastcall TForm1::ServerSocket1ClientConnect(TObject* Sender, 
> TCustomWinSocket* Socket)
>     {
>         Socket->Data = new AnsiString();
>     }
> 
>     void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject* Sender, 
> TCustomWinSocket* Socket)
>     {
>         delete (AnsiString*) Socket->Data;
>     }
> 
> 
> Gambit 
> 
> 
Re: TServerClientWinSocket->Data Help Please
#214
Author: DreamChaser
Date: Thu, 05 Jun 2008 18:04
36 lines
2026 bytes
Now for the stupid question:
How do I assign/read a string to the Socket->Data? Is it a double pointer?

(AnsiString**)Socket->Data = "DreamChaser";
AnsiString asName = (AnsiString**)Socket->Data;

I haven't done alot of pointer stuff, so I'm just asking. Thanks
DC

Remy Lebeau (TeamB) wrote:
> "DreamChaser" <NO-Spam@No-Span.net> wrote in message 
> news:48416d7a$1@newsgroups.borland.com...
> 
>> Has anybody gotten TServerClientWinSocket->Data to work with
>> storing an AnsiString? I got a new AnsiString() assigned to it during
>> the OnClientConnect event, and it seemed to work, but I am unsure
>> where/how to delete it.
> 
> Use the OnClientDisconnect event, ie:
> 
>     void __fastcall TForm1::ServerSocket1ClientConnect(TObject* Sender, 
> TCustomWinSocket* Socket)
>     {
>         Socket->Data = new AnsiString();
>     }
> 
>     void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject* Sender, 
> TCustomWinSocket* Socket)
>     {
>         delete (AnsiString*) Socket->Data;
>     }
> 
> 
> Gambit 
> 
> 
Re: TServerClientWinSocket->Data Help Please
#215
Author: Remy Lebeau (TeamB)
Date: Thu, 05 Jun 2008 19:07
14 lines
1385 bytes
"DreamChaser" <NO-Spam@No-Span.net> wrote in message 
news:48482aae$1@newsgroups.borland.com...

> How do I assign/read a string to the Socket->Data?
> Is it a double pointer?

No.  Simply dereference the pointer you already have, ie:

    *((AnsiString*)(Socket->Data)) = "DreamChaser";
    AnsiString asName = *((AnsiString*)(Socket->Data));


Gambit 
Re: TServerClientWinSocket->Data Help Please
#216
Author: DreamChaser
Date: Fri, 06 Jun 2008 05:43
20 lines
1562 bytes
I was close, I just had the second '*' on the wrong side :)
Thanks again G.
DC

Remy Lebeau (TeamB) wrote:
> "DreamChaser" <NO-Spam@No-Span.net> wrote in message 
> news:48482aae$1@newsgroups.borland.com...
> 
>> How do I assign/read a string to the Socket->Data?
>> Is it a double pointer?
> 
> No.  Simply dereference the pointer you already have, ie:
> 
>     *((AnsiString*)(Socket->Data)) = "DreamChaser";
>     AnsiString asName = *((AnsiString*)(Socket->Data));
> 
> 
> Gambit 
> 
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads