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#
  4. Client Disconnected.

Client Disconnected.

Scheduled Pinned Locked Moved C#
sysadminhelp
5 Posts 3 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.
  • H Offline
    H Offline
    HAHAHA_NEXT
    wrote on last edited by
    #1

    IS there a way to know if the client is disconnected. My server basically receives data from the client. It uses syncronous connection with a winodw timer (Thus avoiding completly teh multitreading issue.)

    H R 2 Replies Last reply
    0
    • H HAHAHA_NEXT

      IS there a way to know if the client is disconnected. My server basically receives data from the client. It uses syncronous connection with a winodw timer (Thus avoiding completly teh multitreading issue.)

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This is a very ambiguous question. What client/server technology are you using? A simple TCP socket? .NET Remoting? Web Services? WebRequests? More information would be helpful.

      Microsoft MVP, Visual C# My Articles

      H 1 Reply Last reply
      0
      • H Heath Stewart

        This is a very ambiguous question. What client/server technology are you using? A simple TCP socket? .NET Remoting? Web Services? WebRequests? More information would be helpful.

        Microsoft MVP, Visual C# My Articles

        H Offline
        H Offline
        HAHAHA_NEXT
        wrote on last edited by
        #3

        I am using simple TCP sockets.

        H 1 Reply Last reply
        0
        • H HAHAHA_NEXT

          I am using simple TCP sockets.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Then it depends greatly on your implementation. Some protocols - like DICT - will require that a client - if possible - send a QUIT message (or equivalent) for proper implementation. This tells the server that your client is disconnecting. Otherwise, when your server sends data you should catch any exceptions - which you should be doing anyway - and handle them appropriately. If you get a SocketException, for instance, check the SocketException.ErrorCode for WSAECONNRESET (10054) or WSAENOTCONN (10057). See the Windows Sockets V2 Error Codes[^] on MSDN for more information.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          • H HAHAHA_NEXT

            IS there a way to know if the client is disconnected. My server basically receives data from the client. It uses syncronous connection with a winodw timer (Thus avoiding completly teh multitreading issue.)

            R Offline
            R Offline
            RNEELY
            wrote on last edited by
            #5

            Open a cmd prompt at your server and type: netstat -a Netstat then displays all connections and listening ports. Check the Microsoft Windows 2000 Server Documentation on Command-line Utilities or type netstat /? for help. Regards, -Ron Sincerely, -Ron

            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