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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dial-up Connection and CAysncSocket PROBLEMS!

Dial-up Connection and CAysncSocket PROBLEMS!

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelp
2 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.
  • W Offline
    W Offline
    Wenrich
    wrote on last edited by
    #1

    in my PocketPC2002 app, I create a CAysncSocket object to send a file to the server. The PocketPC uses diap-up connection to the Internet. I got some problems: Case 1> I don't specify the operating mode of the socket. while the sending is is progress, if the dial-up connection is disconnected, the mySock.Send() does NOT return! so my program hangs! Seems like CAsyncSocket operates in blocking mode, but the documentation says the default mode is non-blocking! Case 2> I specify the operating mode like following: unsigned long mode = 1; ioctlsocket(mySock.m_hSocket, FIONBIO, &mode); // explicitely set it to non-blocking mode then, after a few KBs of data are sent, i get two WSAEWOULDBLOCK errors and then mySock.Send() always returns 0. The whole file can NOT be sent. While in the first case, the whole file can be sent successfully if the network is available throughout the transfer. I'm very confused and frustrated as well! Please HELP! Thanks a million! Wenrich

    A 1 Reply Last reply
    0
    • W Wenrich

      in my PocketPC2002 app, I create a CAysncSocket object to send a file to the server. The PocketPC uses diap-up connection to the Internet. I got some problems: Case 1> I don't specify the operating mode of the socket. while the sending is is progress, if the dial-up connection is disconnected, the mySock.Send() does NOT return! so my program hangs! Seems like CAsyncSocket operates in blocking mode, but the documentation says the default mode is non-blocking! Case 2> I specify the operating mode like following: unsigned long mode = 1; ioctlsocket(mySock.m_hSocket, FIONBIO, &mode); // explicitely set it to non-blocking mode then, after a few KBs of data are sent, i get two WSAEWOULDBLOCK errors and then mySock.Send() always returns 0. The whole file can NOT be sent. While in the first case, the whole file can be sent successfully if the network is available throughout the transfer. I'm very confused and frustrated as well! Please HELP! Thanks a million! Wenrich

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Wenrich wrote: Case 1> I don't specify the operating mode of the socket. while the sending is is progress, if the dial-up connection is disconnected, the mySock.Send() does NOT return! so my program hangs! Seems like CAsyncSocket operates in blocking mode, but the documentation says the default mode is non-blocking! I can not reproduce this behaviour. An asynchronous Send() doesn't usualy block, it rather gives the data to your TCP/IP stack. Which will then send when it "feels good" for sending (NAGLE algorithm etc). But CAsnycSocket has a problem when connecting sockets, if you use hostnames instead of IPs, the DNS could (or will) block a short time. M

      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