Console example (wodSSHServer)
I am trying to create a console version of the fastnotification example.
Everything works, but I cannot make a connection to it.
So somewhere I am forgetting something (I am not good in c++)
I am using the standard wodsshd.[hc] and wodsshdnotify.[hc] of the example (without the dialog code) and a simple main function (see underneath)
Any suggestions ?
thx
Hans
[code]
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
VARIANT var;
LPDISPATCH sshd;
IwodSSHDCom *m_SSHD;
ISSHKeyPair *keys;
CwodSSHDNotify *m_SSHDNotify;
char txt[81];
// initialize MFC and print and error on failure
AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0);
OleInitialize(NULL);
HRESULT hr = CoCreateInstance(__uuidof(CLSID_wodSSHDCom), NULL, CLSCTX_ALL, __uuidof(IID_IwodSSHDCom), (void **)&sshd);
m_SSHD = new IwodSSHDCom(sshd);
m_SSHDNotify = new CwodSSHDNotify();
m_SSHD->SetRefNotification((LPDISPATCH)m_SSHDNotify->GetInterface(&DIID_IwodSSHDNotify)); // initialize events
VariantInit(&var);
// Key loading or generating
puts( Generating key );
keys = new ISSHKeyPair();
keys->AttachDispatch(m_SSHD->GetKeys(), TRUE);
keys->Generate(0 /*RSA*/, var);
puts( Starting server );
m_SSHD->Start(var);
puts( Waiting ... press return to stop server );
gets(txt);
m_SSHD->Stop();
m_SSHD->SetRefNotification(NULL);
m_SSHD->DetachDispatch();
delete m_SSHD;
OleUninitialize();
return 0;
}
[/code]
Complete thread:
- Console example - Hans, 2006-12-30, 20:08
- Re: Console example - woddrazen, 2006-12-30, 20:51
- Re: Console example - Hans, 2006-12-31, 14:52
- Re: Console example - woddrazen, 2006-12-31, 15:04
- Re: Console example - Hans, 2007-01-03, 15:00
- Re: Console example - wodDamir, 2007-01-03, 15:28
- Re: Console example - Hans, 2007-01-03, 22:25
- Re: Console example - wodSupport, 2007-01-03, 23:01
- Re: Console example - Hans, 2007-01-04, 17:32
- Re: Console example - wodSupport, 2007-01-04, 18:55
- Re: Console example - Hans, 2007-01-04, 22:08
- Re: Console example - Hans, 2007-01-04, 22:38
- Re: Console example - Hans, 2007-01-31, 13:17
- Re: Console example - Traveller, 2013-05-25, 17:53
- Re: Console example - wodSupport, 2013-05-25, 17:57
- Re: Console example - Traveller, 2013-05-26, 01:10
- Re: Console example - wodSupport, 2013-05-26, 10:05
- Re: Console example - Traveller, 2013-05-26, 01:10
- Re: Console example - wodSupport, 2013-05-25, 17:57
- Re: Console example - Traveller, 2013-05-25, 17:53
- Re: Console example - Hans, 2007-01-31, 13:17
- Re: Console example - Hans, 2007-01-04, 22:38
- Re: Console example - Hans, 2007-01-04, 22:08
- Re: Console example - wodSupport, 2007-01-04, 18:55
- Re: Console example - Hans, 2007-01-04, 17:32
- Re: Console example - wodSupport, 2007-01-03, 23:01
- Re: Console example - Hans, 2007-01-03, 22:25
- Re: Console example - wodDamir, 2007-01-03, 15:28
- Re: Console example - Hans, 2007-01-03, 15:00
- Re: Console example - woddrazen, 2006-12-31, 15:04
- Re: Console example - Hans, 2006-12-31, 14:52
- Re: Console example - woddrazen, 2006-12-30, 20:51