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 server problem

client server problem

Scheduled Pinned Locked Moved C#
sysadminhelptutorial
3 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.
  • K Offline
    K Offline
    Kamran Zafar
    wrote on last edited by
    #1

    Hello, I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine). Anybody has any idea how to handle such situation. Thanks, Kamran

    L P 2 Replies Last reply
    0
    • K Kamran Zafar

      Hello, I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine). Anybody has any idea how to handle such situation. Thanks, Kamran

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

      You shuld implement somethink like a check, maybe every 3sec a ping or somethink.

      1 Reply Last reply
      0
      • K Kamran Zafar

        Hello, I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine). Anybody has any idea how to handle such situation. Thanks, Kamran

        P Offline
        P Offline
        Polis Pilavas
        wrote on last edited by
        #3

        You should check for such an exception constantly. I would place a timer with the try..catch block inside and set the interval to 1000 or something like that. Polis. Can you practice what you teach?

        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