I am very new to development and have been sinking my teeth into C#. I have an application that was written in C++ which is out of my depth, and I was wondering if someone could explain how I would recreate this in c#.

The application sends message to linux service via a socket connection. The message is in the form of a struct:

struct alert
	unsigned short size;
	unsigned short signature;
	unsigned short bperiod;
	unsigned short bduty;
	unsigned short svolume;
	unsigned short stone;
	unsigned short sfrequency;
	unsigned short speriod;
	unsigned short sduty;

This app was designed to use a form, but this was of no use, so I did ammed this to recieve it's settings via the command line.

szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
   	sleepcount = _ttoi(szArglist[9]); 
	m_Request.size					= sizeof(m_Request);
	m_Request.signature				= ALERT_REQUEST_SIGNATURE;
	m_Request.beacon_period			= _ttoi(szArglist[2]); 
	m_Request.beacon_duty			= _ttoi(szArglist[3]); 
	m_Request.sounder_volume		= _ttoi(szArglist[4]); 
	m_Request.sounder_tone			= _ttoi(szArglist[5]); 
	m_Request.sounder_frequency		= _ttoi(szArglist[6]); 
	m_Request.sounder_period		= _ttoi(szArglist[7]);
	m_Request.sounder_duty			= _ttoi(szArglist[8]); 


The code for the SendRequest:

void CTestDialog::SendRequest(DWORD dwUnit)
	if (Connect(dwUnit) && ::send(m_sktUnit, reinterpret_cast<LPSTR>(&m_Request), sizeof(m_Request), 0) != sizeof(m_Request)) {
		m_sktUnit = INVALID_SOCKET;

Thank you in advance for your help.

To save your time you can try "C++ to C# Converter". I am not very sure will it work perfectly for your requirement but you can try just once.


It is a licence software and demo is also available.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.