summaryrefslogtreecommitdiffabout
path: root/Resolver.cpp
authorMichael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
commit9938ea772d372ba955b7bc1f1c48a062c3a36f8a (patch) (side-by-side diff)
treea98185df944e3a763f9557aa74bc2837b343f048 /Resolver.cpp
downloadpumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.zip
pumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.tar.gz
pumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.tar.bz2
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'Resolver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--Resolver.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/Resolver.cpp b/Resolver.cpp
new file mode 100644
index 0000000..0ec66d3
--- a/dev/null
+++ b/Resolver.cpp
@@ -0,0 +1,71 @@
+// Resolver.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "PumpKIN.h"
+#include "Resolver.h"
+#include "PumpKINDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CResolver
+
+CResolver::CResolver()
+{
+ ASSERT(NULL);
+}
+
+CResolver::~CResolver()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CResolver, CWnd)
+ //{{AFX_MSG_MAP(CResolver)
+ ON_WM_CREATE()
+ ON_MESSAGE(WM_RESOLVED, OnResolved)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CResolver message handlers
+
+CResolver::CResolver(CXferSocket *socket)
+ : socket(socket)
+{
+}
+
+int CResolver::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ ASSERT(socket);
+CString hostName = socket->m_HostName;
+int at = hostName.Find('@');
+ if(at>=0)
+ hostName=hostName.Mid(at+1);
+ m_hAsync=WSAAsyncGetHostByName(m_hWnd,WM_RESOLVED,(LPCTSTR)hostName,(char*)socket->m_ResolveBuff,sizeof(socket->m_ResolveBuff));
+ ASSERT(m_hAsync);
+ return 0;
+}
+
+LRESULT CResolver::OnResolved(WPARAM wP,LPARAM lP)
+{
+ if(WSAGETASYNCERROR(lP))
+ socket->OnFailedToResolve();
+ else
+ socket->OnResolved();
+ return 0;
+}
+
+BOOL CResolver::Resolve()
+{
+ return Create(NULL,"PumpKIN-Resolver",WS_CHILD,CRect(0,0,0,0),socket->m_Daddy,0);
+}