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#
  4. Time out BeginReceive() operation

Time out BeginReceive() operation

Scheduled Pinned Locked Moved C#
csharpdesignsysadminhelpquestion
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.
  • C Offline
    C Offline
    c guy3811
    wrote on last edited by
    #1

    In my server, I am using Asynchronous socket connections. After a client connects, the server Asynchronously waits for the login credentials using Socket.BeginReceive. I have not had this issue yet, but in the what ifs.... Suppose a client connects, is sent a promt from the server to enter login credentials, then just sits there sending nothing. The server holds that asynchronous operation indefinately until something is sent or the client disconnects. How would I time out that operation? I dont think SetSocketOption works on asynchronous operations. The server would not stop accepting connections by design, but it would keep that socket open, and I dont want that. Any ideas? Thanks c#guy

    L 1 Reply Last reply
    0
    • C c guy3811

      In my server, I am using Asynchronous socket connections. After a client connects, the server Asynchronously waits for the login credentials using Socket.BeginReceive. I have not had this issue yet, but in the what ifs.... Suppose a client connects, is sent a promt from the server to enter login credentials, then just sits there sending nothing. The server holds that asynchronous operation indefinately until something is sent or the client disconnects. How would I time out that operation? I dont think SetSocketOption works on asynchronous operations. The server would not stop accepting connections by design, but it would keep that socket open, and I dont want that. Any ideas? Thanks c#guy

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      c#guy3811 wrote:

      I dont think SetSocketOption works on asynchronous operations.

      There is no difference. They work either way. xacc.ide-0.1.1 released! :) Download and screenshots

      C 1 Reply Last reply
      0
      • L leppie

        c#guy3811 wrote:

        I dont think SetSocketOption works on asynchronous operations.

        There is no difference. They work either way. xacc.ide-0.1.1 released! :) Download and screenshots

        C Offline
        C Offline
        c guy3811
        wrote on last edited by
        #3

        Really? I set the receiveTimeout option for 100ms, and after about 5 minutes the client was still connected. Are you sure?

        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