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. socket problem: works in visual studio, not as release

socket problem: works in visual studio, not as release

Scheduled Pinned Locked Moved C#
csharpsysadminvisual-studiohelpquestion
6 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.
  • T Offline
    T Offline
    TimWallace
    wrote on last edited by
    #1

    I am developing an application in which a connection to a server application on another computer within our network is established. I am using a System.Net.Sockets.Socket to establish the connection to said server app. Upon successfully connecting to the server app, I send a connect message with the login credentials the user provided. In response, the server app should send back a message to indicate a successful or unsuccessful login. My problem is this: when running from within the Visual Studio development, it works flawlessly. When I launch the executable directly, I do not receive the return message from the server app. Any ideas?

    L 1 Reply Last reply
    0
    • T TimWallace

      I am developing an application in which a connection to a server application on another computer within our network is established. I am using a System.Net.Sockets.Socket to establish the connection to said server app. Upon successfully connecting to the server app, I send a connect message with the login credentials the user provided. In response, the server app should send back a message to indicate a successful or unsuccessful login. My problem is this: when running from within the Visual Studio development, it works flawlessly. When I launch the executable directly, I do not receive the return message from the server app. Any ideas?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Do you log all exceptions? What are the symptoms other than "it does not work"? Maybe you gave VS a permanent green light in your firewall, and it is blocking your app outside VS? :)

      Luc Pattyn


      Local announcement (Antwerp region): Lange Wapper? Neen!


      T 1 Reply Last reply
      0
      • L Luc Pattyn

        Do you log all exceptions? What are the symptoms other than "it does not work"? Maybe you gave VS a permanent green light in your firewall, and it is blocking your app outside VS? :)

        Luc Pattyn


        Local announcement (Antwerp region): Lange Wapper? Neen!


        T Offline
        T Offline
        TimWallace
        wrote on last edited by
        #3

        Luc: No firewalls are on between "here" and "there". No exceptions are being thrown. The server application is logging the receipt of the message from the client application.

        L 1 Reply Last reply
        0
        • T TimWallace

          Luc: No firewalls are on between "here" and "there". No exceptions are being thrown. The server application is logging the receipt of the message from the client application.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Odd. Did you try debug build running inside VS? release build running inside VS? debug build double-clicked in bin\debug folder? release build double-clicked in bin\release folder? the difference would be optimizations (timing difference or bugs), and error handling (VS settings influence some). Do you use time-outs? with sufficient value? and failures get logged? or is the client hanging, waiting on a reply? :)

          Luc Pattyn


          Local announcement (Antwerp region): Lange Wapper? Neen!


          T 1 Reply Last reply
          0
          • L Luc Pattyn

            Odd. Did you try debug build running inside VS? release build running inside VS? debug build double-clicked in bin\debug folder? release build double-clicked in bin\release folder? the difference would be optimizations (timing difference or bugs), and error handling (VS settings influence some). Do you use time-outs? with sufficient value? and failures get logged? or is the client hanging, waiting on a reply? :)

            Luc Pattyn


            Local announcement (Antwerp region): Lange Wapper? Neen!


            T Offline
            T Offline
            TimWallace
            wrote on last edited by
            #5

            Luc: There was one point where I was missing code in a catch statement. That was the exception that was getting thrown. After I added code to handle that exception, I discovered that the problem was stemming from a difference in the amount of data included in the message sent from my Test tier versus my local tier. Due to this size difference, a flaw in my received handler was being tripped. Fixed my code and everything works as expected. Thanks for your question about exceptions. If forced me to go back and check all of my catch statements. Tim

            L 1 Reply Last reply
            0
            • T TimWallace

              Luc: There was one point where I was missing code in a catch statement. That was the exception that was getting thrown. After I added code to handle that exception, I discovered that the problem was stemming from a difference in the amount of data included in the message sent from my Test tier versus my local tier. Due to this size difference, a flaw in my received handler was being tripped. Fixed my code and everything works as expected. Thanks for your question about exceptions. If forced me to go back and check all of my catch statements. Tim

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              yep. catching and somehow showing all exceptions is a powerful technique. whenever I see an empty catch statement (and that is quite frequently around here, some people think it is wise to skip or postpone error handling), I make sure the perpetrator will not forget about it any time soon ... :)

              Luc Pattyn


              Local announcement (Antwerp region): Lange Wapper? Neen!


              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