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. .Net Client app holding socket...

.Net Client app holding socket...

Scheduled Pinned Locked Moved C#
questioncsharpcom
15 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.
  • S Stefan Troschuetz

    It would be very useful to provide the code where you actually call the web service.


    www.troschuetz.de

    J Offline
    J Offline
    Jason Weibel
    wrote on last edited by
    #3

    Not sure if this helps but it's worth a try. Public Function SetUpWS() As EmpInfoWS.EmployeeInformation Dim wsEmpInfo As New EmpInfoWS.EmployeeInformation wsEmpInfo.Url = GetEmpInfoWSURL() wsEmpInfo.Credentials = System.Net.CredentialCache.DefaultCredentials Return wsEmpInfo End Function Jason W.

    1 Reply Last reply
    0
    • J Jason Weibel

      I have a .net windows client application that queries a .net web service. After the client has called the web service if netstat is run from the command line the results will show 10 sockets still open. Below is the code from my client app. My questions are 1. Why does the client app need 10 sockets? 2. What can I do to force the closing of the sockets since the GC.Collect() & GC.WaitForPendingFinalizers() methods don't seem to be doing it? 3. Does it really matter if the sockets are not immediately closed? Private Sub LogIn() If IsUserOffLine() Then Exit Sub Dim wsEmpInfo As EmpInfoWS.EmployeeInformation = BF.SetUpWS() Try wsEmpInfo.SetEmployeeCheckIn(BF.GetUserName, txtLogInComments.Text) Catch Ex As Exception Call IsUserOffLine() Finally wsEmpInfo.Dispose() End Try Dim tRefreshForm As New Thread(New ThreadStart(AddressOf RefreshForm)) Try tRefreshForm.Start() Catch ex As Exception tRefreshForm = Nothing End Try End Sub Private Sub RefreshForm() Try Call PopulateForm() Call HandleNotify() Call ShowScrollingNote() Call CleanUp() Catch End Try End Sub Private Sub CleanUp() Try GC.Collect() GC.WaitForPendingFinalizers() Catch End Try End Sub I appreciate any suggesting you have, thank you. Jason W.

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

      was is the actual state of the connection? its probably in a PENDING_CLOSE state (or something like that). xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

      J 1 Reply Last reply
      0
      • L leppie

        was is the actual state of the connection? its probably in a PENDING_CLOSE state (or something like that). xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

        J Offline
        J Offline
        Jason Weibel
        wrote on last edited by
        #5

        Here is what netstat is showing. TCP COMPUTERNAME:4483 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4484 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4485 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4486 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4487 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4488 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4489 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4490 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4491 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4492 111.111.111.111:https TIME_WAIT Jason W.

        L 1 Reply Last reply
        0
        • J Jason Weibel

          Here is what netstat is showing. TCP COMPUTERNAME:4483 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4484 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4485 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4486 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4487 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4488 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4489 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4490 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4491 111.111.111.111:https TIME_WAIT TCP COMPUTERNAME:4492 111.111.111.111:https TIME_WAIT Jason W.

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

          Exactly, the socket is in a closing state. :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

          J 1 Reply Last reply
          0
          • L leppie

            Exactly, the socket is in a closing state. :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

            J Offline
            J Offline
            Jason Weibel
            wrote on last edited by
            #7

            Cool, is there a site that tells about the socket status options. I need to point my manager to it so he will get off my back. Thank you for the help. Jason W.

            L 2 Replies Last reply
            0
            • J Jason Weibel

              Cool, is there a site that tells about the socket status options. I need to point my manager to it so he will get off my back. Thank you for the help. Jason W.

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

              If he doesnt believe, tell him to hire a consultant to come tell him the same, and a formal written apology to you and his superior. He will shut up quick. But I'll have a look while I'm at it. :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

              J 1 Reply Last reply
              0
              • J Jason Weibel

                Cool, is there a site that tells about the socket status options. I need to point my manager to it so he will get off my back. Thank you for the help. Jason W.

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

                http://www.skynet.ie/~heathclf/fyp/fyp-interim/node13.html[^] The TIME_WAIT state is a state that all the TCP connections enter into when the connection has been closed. The length of time for this state is 240 seconds, which is to allow for any duplicate segments still in the network from the previous connection to expire. If you have direct access to the TcpClient or Socket class in your webservice (not sure of that), you can try tweaking some of the settings. HTH :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                J 1 Reply Last reply
                0
                • L leppie

                  If he doesnt believe, tell him to hire a consultant to come tell him the same, and a formal written apology to you and his superior. He will shut up quick. But I'll have a look while I'm at it. :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                  J Offline
                  J Offline
                  Jason Weibel
                  wrote on last edited by
                  #10

                  Trust me I would love to tell him that, at this point I can't however. Jason W.

                  1 Reply Last reply
                  0
                  • L leppie

                    http://www.skynet.ie/~heathclf/fyp/fyp-interim/node13.html[^] The TIME_WAIT state is a state that all the TCP connections enter into when the connection has been closed. The length of time for this state is 240 seconds, which is to allow for any duplicate segments still in the network from the previous connection to expire. If you have direct access to the TcpClient or Socket class in your webservice (not sure of that), you can try tweaking some of the settings. HTH :) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                    J Offline
                    J Offline
                    Jason Weibel
                    wrote on last edited by
                    #11

                    Thank you for the help. Jason W.

                    L 1 Reply Last reply
                    0
                    • J Jason Weibel

                      Thank you for the help. Jason W.

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

                      AFAI can see, its part of the TCP/IP stack, not sure how u would go around changing it. Also any routers between you and the destination could have some control over it too. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                      J 1 Reply Last reply
                      0
                      • L leppie

                        AFAI can see, its part of the TCP/IP stack, not sure how u would go around changing it. Also any routers between you and the destination could have some control over it too. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                        J Offline
                        J Offline
                        Jason Weibel
                        wrote on last edited by
                        #13

                        What is AFAI? Jason W.

                        L 1 Reply Last reply
                        0
                        • J Jason Weibel

                          What is AFAI? Jason W.

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

                          A(s) F(ar) A(s) I K(now) ;P xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                          J 1 Reply Last reply
                          0
                          • L leppie

                            A(s) F(ar) A(s) I K(now) ;P xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

                            J Offline
                            J Offline
                            Jason Weibel
                            wrote on last edited by
                            #15

                            If it isn't a problem I would like to pick your brain a little more. I found an article that says 'The side shutting down the connection gets the TIME_WAIT.' is this true. If it is then I don't need to worry about causing a denial of service on the server. Thoughts? Jason W.

                            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