Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CAsyncSocket questions

CAsyncSocket questions

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi, I am still having problems with my TCP/IP connection as I get a timeout notification in my OnConnect overridable I have a few questions 1) do the Socket and Bind Function do the same as Create ? 2) Would using the SetSockOpt SO_KEEPALIVE options help ? 3) could someone give a example of the C++ syntax for using the SOCKET operator in obtaining the socket handle Thanks

    S 1 Reply Last reply
    0
    • F ForNow

      Hi, I am still having problems with my TCP/IP connection as I get a timeout notification in my OnConnect overridable I have a few questions 1) do the Socket and Bind Function do the same as Create ? 2) Would using the SetSockOpt SO_KEEPALIVE options help ? 3) could someone give a example of the C++ syntax for using the SOCKET operator in obtaining the socket handle Thanks

      S Offline
      S Offline
      Sivaraman Dhamodharan
      wrote on last edited by
      #2

      Provide the code snippet of Client that make connect request and code snippet that listens on a port xyz. With that people can help you.

      Programming Article

      F 1 Reply Last reply
      0
      • S Sivaraman Dhamodharan

        Provide the code snippet of Client that make connect request and code snippet that listens on a port xyz. With that people can help you.

        Programming Article

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        I have 4 CAsyncSocket derived classes wrapped inside 4 Derived CWinThread Class in the CWinThread::Initinstance I set the ipaddr = "192.168.1.4" When I use NULL as the last parameter in the CAsynSocket::create or BIND I am successful in creating a socket however when I use the ipaddr "192.168.1.4" the ipaddr of the machine I get WSAEADDRNOTAVAIL The listening code is MainFrame Assembler EZASMI select which is intended to process multiple I/O's on multiple sockets

              EZASMI TYPE=SELECT,      Issue Macro                      
                   MAXSOC=MAXSOC1,    SPECIFY MAXIMUM NUMBER OF SOCKETS
                   TIMEOUT=TIMEVAL,                                    
                   RSNDMSK=RSNDMSK,   READ MASK                        
                   RRETMSK=RRETMSK,   RETURN FROM READ                 
                   WSNDMSK=WSNDMSK,   WRITE MASK                       
                   WRETMSK=WRETMSK,   RETURN FROM WRITE                
                   ESNDMSK=ESNDMSK,                                    
                   ERETMSK=ERETMSK,                                    
                   ERRNO=ERRNO,       (Specify ERRNO field)            
                   RETCODE=RETCODE,   (Specify RETCODE field)          
                   ECB=MY\_ECB,        MAIN TASK EMB                    
                   ERROR=ERROR,       Abend if Macro error             
                   TASK=MYTIE,                                         
                   MF=(E,MY\_PARM)                                      
        

        thisocket.Socket(SOCK_STREAM,FD_READ|FD_WRITE|FD_CONNECT,NULL,AF_INET);
        if(thisocket.Bind(thisocket.port,ipaddr) == 0)
        error_code = GetLastError();
        thisocket.GetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val_ptr, SOL_SOCKET);
        if(thisocket.SetSockOpt(SO_KEEPALIVE | SO_DEBUG, &thisocket.option,val, SOL_SOCKET) == 0)
        error_code = GetLastError();

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups