Results 1 to 7 of 7

Thread: Winsock Problems

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96

    Winsock Problems

    Im just bearly getting use to using VC++ and was woundering if any of you could help me. Im making a program. A simple one. that should connect to itself and send a message when it does. I have turned my winsock to a veriable (m_winsock1) and I Try to use the command m_winsock1.connect("127.0.0.1", 1234); And of course I get an error when comiling.

    error C2664: 'Connect' : cannot convert parameter 1 from 'char [10]' to 'const struct tagVARIANT &'
    Reason: cannot convert from 'char [10]' to 'const struct tagVARIANT'
    No constructor could take the source type, or constructor overload resolution was ambiguous

    Any hints?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96
    Anyone? Anyone?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96
    What? did I post this on the wrong forum or something?

  4. #4
    Zaei
    Guest
    As far as I can tell, you are trying to pass a string into a function that wants a VARIANT. C++ VARIANTS do not work like VB ones, with automatic type conversion. You must load the string into a VARIANT first, then use a conversion function to pass into the function.

    Z.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Variants aren't even intrinsic to C++.

    The closest it has is a union, but that still assumes you know what type you're reading out of it - it won't convert for you.

    VARIANT is part of COM, I think (it's there for pointerless languages I think).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    i couldn't get winsock to work on my comp

    i followed a few tutorials, try this:


    Code:
       //i think this is how it goes
       char cIP[4]={'127','0','0','1'};
       unsigned short sPort = 1234;

    try passing the parameters using those names, because i did it that way, and it didnt give me any problems.
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96

    cogman

    thanx. I had my bro come and try and figure it out. we decided it would be easier to do it the c++ way and not the VB way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width