Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i use customized client class in CTcpServer? #290

Closed
mnt-github opened this issue Jun 28, 2024 · 2 comments
Closed

Can i use customized client class in CTcpServer? #290

mnt-github opened this issue Jun 28, 2024 · 2 comments

Comments

@mnt-github
Copy link

I want to use customized client class pointer in CTcpServer.

/* Customized client class */
class MyClient
{
    ...
}




/* CTcpServer OnAccept */
EnHandleResult MyServer::OnAccept(ITcpServer* pSender, CONNID dwConnID, UINT_PTR soClient)
{
    ...
    MyClient *ptr = new MyClient();    // Create Client Point
    
    // I want to register **ptr** to Server.
    
    return HR_OK;
}

EnHandleResult MyServer::OnReceive(ITcpServer* pSender, CONNID dwConnID, const BYTE* pData, int iLength)
{
    ...
    
    // I want to get **Client Class Ptr** from Server.
    
    return HR_OK;
}

What should I do?

@FunlyDay
Copy link

FunlyDay commented Jun 28, 2024 via email

@ldcsaa
Copy link
Owner

ldcsaa commented Jul 11, 2024

Yes, use SetConnectionExtra() to hold the custom data.
refer to \Windows\Demo\HttpProxy

@ldcsaa ldcsaa closed this as completed Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants