How to start C++ GEV Server correctly using CVB SDK API


I am learning how to use the CVB SDK to create a GigE Vision Server to act as a Virtual Camera to send image over to an image acquisition client.

I am able to successfully use the C# CVB SDK to do so.
However, when trying to replicate the same thing in C++ SDK, I am unable to use the CVB Management Console to discover the Virtual Camera, much less acquiring it.

I used netstat -an -u udp, and is able to see that port 3956 is started by the GEV server. However, CVB management console is not able to discover it.

Below is a snippet of my main C++ code:
*My C++ CVB project can be compiled successfully, and there are no exceptions when running the console application.

Any help or enlightenment on why I am not able to discover the GEV Virtual Camera is appreciated.

int main(int argc, char* argv[])
cout << “start gev server\n”;

IMG img;
cvbres_t nResult = LoadImageFile("%CVB%\\Tutorial\\ClassicSwitch.emu", img);
if (nResult < 0)
	throw std::exception();

TDriver nDriver = DT_Filter;
m_hGevServer = CreateGevServerEx(nDriver);

// configure server
nResult = GSSetImage(m_hGevServer, img);
if (nResult < 0)
	throw std::exception();

// set acquisition mode
TAcquisitionMode acqMode = AM_Automatic;
GSSetAcquisitionMode(m_hGevServer, acqMode);

// register server events
if (IsGevServer(m_hGevServer))
	GSRegisterEvent(m_hGevServer, SE_Connected, &Empty, NULL, m_nSERemoteEndpointConnectedEventID);
	GSRegisterEvent(m_hGevServer, SE_Disconnected, &Empty, NULL, m_nSERemoteEndpointDisconnectedEventID);
	GSRegisterEvent(m_hGevServer, SE_AcquisitionStart, &Empty, NULL, m_nSEAcquisitionStartEventID);
	GSRegisterEvent(m_hGevServer, SE_AcquisitionStop, &Empty, NULL, m_nSEAcquisitionStopEventID);
	GSRegisterEvent(m_hGevServer, SE_ImageSnapped, &Empty, NULL, m_nSENewImageEventID);

// add custom feature in category

// set custom version/id
nResult = GSSetInfoAsString(m_hGevServer, GSI_ServerUserVersion, "_C++-Example");
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionMajor, 1);
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionMinor, 0);
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionSubMinor, 0);
if (nResult < 0) throw std::exception();

// start server
std::vector<gsipv4> m_Interfaces;
GEVIFACELIST ifaceList = CreateInterfaceList();
size_t nIfaces = ILCount(ifaceList);
for (size_t nIndex = 0; nIndex < nIfaces; ++nIndex)
	// add IP to interfaces list
	gsipv4 nIP = 0;
	ILIPv4Address(ifaceList, nIndex, nIP);

gsipv4 nIP = m_Interfaces[2]; //for
nResult = GSStartIPv4(m_hGevServer, nIP);
if (nResult < 0)
	throw std::exception();

cout << "gev server started " << nResult << "\n";

while (true)

return 0;


Hi, could you post your whole project?
This way it is easier for us to find the problem.

Hi Tim,

I have uploaded the CPP (not working) and CSharp (working) zipped Visual Studio project.

CPP - Download Link
CSharp - Download Link

Thank you for the assistance.

Hmm your C++ example is working just fine for me (only thing I did was update the Visual Studio Toolset).
Could you try a different IP?

Hi tim,

I am using Visual Studio 2013 to develop the attached C++ project. It can be compiled successfully and run with the GEV port 3956 utilized, but I am not able to discover the GEV virtual camera on the CVB management console.

You were able to do so for my C++ project?

Hi Tim,

I managed to resolve the issue with my C++ application.
When i changed the directory of the image emulator to the one on my desktop, then the application is working.

I suspect is to do with the permission access to the image emulator in the Program Files.