• Winsock2 woes

    From Deuce@SYNCNIX to Xucaen on Thursday, November 26, 2015 13:17:49
    Re: Winsock2 woes
    By: Xucaen to All on Wed Nov 25 2015 02:17 pm

    Well, my project is dead in the water until I can find another way to convert an int into a socket. Does anyone know of a third party lib I can use in visual c that handles converting ints to sockets?

    There's OpenDoors. http://cvs.synchro.net/cgi-bin/viewcvs.cgi/src/odoors/?view=tar

    ---
    http://DuckDuckGo.com/ a better search engine that respects your privacy.
    Mro is an idiot. Please ignore him, we keep hoping he'll go away.
    ■ Synchronet ■ My Brand-New BBS (All the cool SysOps run STOCK!)
  • From Xucaen@TIMEPORT to Digital Man on Thursday, November 26, 2015 18:26:51
    Are you calling WSAStartup()?

    Call him? I never met him! (Sorry, a bit of humor)

    I will look into that.



    Did you check the return value of send()?


    At one point it was returning the correct number of bytes I was expecting.



    Have you looked at any working example code (e.g. sbbs/xtrn/sdk)?



    I don't have an sdk directory so I'll have to go get it, I haven't yet.



    Sorry if the quoting in this message if messed up. I'm entering this on my Android phone.

    ---
    ■ Synchronet ■ The Time Portal - timeport.synchro.net:2112 - Celebrating the past from the futu
  • From Xucaen@TIMEPORT to Digital Man on Thursday, November 26, 2015 20:32:34
    Re: Winsock2 woes
    By: Xucaen to Digital Man on Thu Nov 26 2015 10:01 am

    #pragma comment(lib, "Ws2_32.lib")
    #include <WinSock2.h>



    Then I have a function that writes data to the socket


    void IOHandler::writeBytes(string line) const
    {

    if (dropfile->commType == 0)
    {
    cout << line;
    }
    else if (dropfile->commType == 2)
    {
    int bytes = ::send((SOCKET)dropfile->handle, line.c_str(), strlen(line.c_str()), 0);
    }
    }




    Are you calling WSAStartup()?



    That was it. I am now sending data over the socket. Now the real work begins. ;-)

    Thanks you so much! I think when I am done I am going to document what I did and spread the word far and wide. (there were a few people askign the same questions as I on Stack Exchange and the answer always seems to be "you can't with winsock". Well, we proved them wrong. \o/

    Have a great evening!

    ---
    ■ Synchronet ■ The Time Portal - timeport.synchro.net:2112 - Celebrating the past from the futu
  • From Xucaen@TIMEPORT to All on Friday, November 27, 2015 12:28:31
    This is interesting. According to the documentation I managed to find regarding the WSAStartup(), it says I also have to call WSACleanup().

    And according to this:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms741549(v=vs.85).aspx?f=255

    ---
    ■ Synchronet ■ The Time Portal - timeport.synchro.net:2112 - Celebrating the past from the futu