Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:


I am creating a server app in C++.NET, I am trying to make it multithreaded. I created a class called multiserver, and it has the method start listening to listen for connections.
void MultiServer::startListening()
      //static variables
      IPHostEntry *ipHost;
      IPAddress *ipA;
      IPEndPoint *ipEP;

    //establish endpoint
      ipHost = Dns::Resolve(Dns::GetHostName());
      ipA = ipHost->AddressList[0];
      ipEP = new IPEndPoint(ipA, 11000);

      //start blocking
      tListen = new TcpListener(ipEP);

      //loop to start connections
                  clientSoc = tListen->AcceptSocket();
                  clService = new Thread(new ThreadStart(this, servClient));
            }//end try
            catch(Exception *e)
                  MessageBox::Show(e->ToString(), S"Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
            }//end catch
      }//end while
}//end start listening

On the main Form1 for the app I have another thread start
public __gc class Form1 : public System::Windows::Forms::Form

                  //thread directing
                  MultiServer *ms;
                  clientList = new ArrayList();
                  processor = new Thread(new ThreadStart(&ms, ms->startListening));

The problem I am have is this:
error C3754: 'void MultiServer::startListening(void)': cannot be called through a variable of type 'MultiServer __gc ** '
Can anyone help?
  • 3
  • 3
1 Solution
fsharerAuthor Commented:
Tried it, by creating a new class of listening giving it the start listening function, and inheriting for my other class multiserver, then having it create a new class of listening and refrencing it in the trhead but gives the same error.

#pragma once

#include "MultiServer.h"

public __gc class Listening : public MultiServer
void startListening();      //constructor

};//end class listening

MultiServer *ms = new Listening;
clientList = new ArrayList();
processor = new Thread(new ThreadStart(ms, &Listening::startListening)); <--Line I am getting error C3754
Is it giving the same message, or is the type in the error message different?
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

fsharerAuthor Commented:
Sorry here is the new error:
 error C3754: 'void Listening::startListening(void)': cannot be called through a variable of type 'MultiServer __gc *'

Its' a little different from the one above, but doesnt it mean the same
I seem to remember something about a 'virtual' keyword.  Try marking the function as virtual.  I'm really starting to shoot from the hip now, though.
fsharerAuthor Commented:
Its ok, it didnt work, I think I just need to hit the books harder. But I will still give you the points for helping me out.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now