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] 












