Valhalla Legends Forums Archive | C/C++ Programming | Need help on MSVC++ socket error

AuthorMessageTime
R.a.B.B.i.T
Okay, so I'm using MFC, right?  Well, that's all fine and dandy.  I've got my form, I've got my classes, member variables, all that shit.  My problem, however, is the following:
[code]void void CIde_testDlg::OnGet()
{
tagVARIANT addr;
tagVARIANT port;
addr.pcVal = "valhallalegends.com";
port.intVal = 80;
m_sock.Connect(addr, port);
}[/code]Everything compiles fine, but when I click the "Get" button, a message box pops up and says "Unsupported variant types".  Google and MSDN failed to help me figure out what's going on, so I hope someone here knows.
April 13, 2005, 12:01 AM
Myndfyr
Why are you using VARIANT structures for your data?  Why not just your normal everyday types?

[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_casyncsocket.3a3a.connect.asp[/url] talks about the overloaded CAsyncSocket::Connect method.
April 13, 2005, 12:12 AM
R.a.B.B.i.T
Because I'm still fairly new to MFC, and that's what the control uses (which was created by MFC).
April 13, 2005, 1:31 AM
Myndfyr
[quote author=rabbit link=topic=11251.msg108399#msg108399 date=1113355876]
Because I'm still fairly new to MFC, and that's what the control uses (which was created by MFC).
[/quote]

I guess I still don't understand.  You're not using an actual MFC socket object (CAsyncSocket or CSocket), but another control that was created *using* MFC?

What type is the m_sock variable?
April 13, 2005, 1:51 AM
R.a.B.B.i.T
The m_sock variable is a CMSWinsockControl, which is the only option available.
April 13, 2005, 1:58 AM
Myndfyr
[quote author=rabbit link=topic=11251.msg108407#msg108407 date=1113357498]
The m_sock variable is a CMSWinsockControl, which is the only option available.
[/quote]

Do you *need* to use a control?  MSDN returns nothing when I search for that type.

If you're using MFC, why not just use the built-in CAsyncSocket or CSocket classes?  These are part of MFC.
April 13, 2005, 2:05 AM
R.a.B.B.i.T
Thanks, I don't have any problems now (so far).  I didn't know about those :D
April 13, 2005, 9:56 PM

Search