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. Windows API
  4. Nonblocking connect

Nonblocking connect

Scheduled Pinned Locked Moved Windows API
questionsysadminhelp
4 Posts 2 Posters 18 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.
  • M Offline
    M Offline
    MrDooDoo
    wrote on last edited by
    #1

    Hi everyone, I am trying to write a program which searches for a service on a network. I tries to connect to IPs in the range of [192.168.1.0 to 192.168.1.255] and a specified port. but the connect function of Winsock freezes and blocks on first IP (192.168.1.0). I think that I should change the blocking behavior of socket. I was wondering if somebody could answer following question: 1) Do I have to change my socket to non blocking mode? Is there other solutions which solves my problem?(In other words, did I choose a right way to detect the service?) 2)How can I change my socket to non blocking mode? regards,

    L 1 Reply Last reply
    0
    • M MrDooDoo

      Hi everyone, I am trying to write a program which searches for a service on a network. I tries to connect to IPs in the range of [192.168.1.0 to 192.168.1.255] and a specified port. but the connect function of Winsock freezes and blocks on first IP (192.168.1.0). I think that I should change the blocking behavior of socket. I was wondering if somebody could answer following question: 1) Do I have to change my socket to non blocking mode? Is there other solutions which solves my problem?(In other words, did I choose a right way to detect the service?) 2)How can I change my socket to non blocking mode? regards,

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      1. Yes, if you don't want to wait. 2. See http://www.scottklement.com/rpg/socktut/nonblocking.html[^].

      Veni, vidi, abiit domum

      M 1 Reply Last reply
      0
      • L Lost User

        1. Yes, if you don't want to wait. 2. See http://www.scottklement.com/rpg/socktut/nonblocking.html[^].

        Veni, vidi, abiit domum

        M Offline
        M Offline
        MrDooDoo
        wrote on last edited by
        #3

        Thanks my friend, :) Can you tell me how I can cancel a non blocking connect? I mean when I call non blocking connect the process begins and my function returns immediately but after a while I want to cancel the process. Do I have to close the socket? Or there is a simpler way that avoid closing socket? regards,

        L 1 Reply Last reply
        0
        • M MrDooDoo

          Thanks my friend, :) Can you tell me how I can cancel a non blocking connect? I mean when I call non blocking connect the process begins and my function returns immediately but after a while I want to cancel the process. Do I have to close the socket? Or there is a simpler way that avoid closing socket? regards,

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          MrDooDoo wrote:

          Do I have to close the socket?

          I'm not sure, although that is what is suggested in that link I provided. I guess you need to try it and see what happens.

          Veni, vidi, abiit domum

          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