View previous topic :: View next topic |
Author |
Message |
DaveB
Joined: 08 Feb 2011 Posts: 15
|
Posted: Mon Feb 13, 2012 7:56 pm Post subject: Trouble with sockets |
|
|
One of my programmers is reporting that a socket read is returning immediately with no data when he runs the encrypted version of our app (even though there has been data written to the socket from another application).
We are using .Net 3.5, and he is using TCPClient and TCPListener for managing socket traffic. I have not had a chance to troubleshoot this myself, but before I do I want to know if there are known issues in this area?
The socket read works fine when using the non-encrypted version of the app.
Thanks,
Dave _________________ Dave |
|
Back to top |
|
|
DaveB
Joined: 08 Feb 2011 Posts: 15
|
Posted: Mon Feb 13, 2012 8:02 pm Post subject: clarification |
|
|
After speaking further with the programmer, it seems that the encrypted app is doing the socket write, and it's the other app that is reading zero bytes from the socket.
So, he is guessing that the encrypted version of our app is somehow failing to write the bytes to socket.
Any ideas? _________________ Dave |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Feb 13, 2012 10:20 pm Post subject: |
|
|
There are no known issues with using sockets. I think it is unlikely that the encryption is causing this problem - but anything is possible. You should be able to build a debug version of your bootstrapper and debug the problem to see exactly what is occurring.
If you can manage to isolate the problem in a small test project would be happy to look at it. _________________ Infralution Support |
|
Back to top |
|
|
DaveB
Joined: 08 Feb 2011 Posts: 15
|
Posted: Wed Feb 15, 2012 3:46 pm Post subject: problem found |
|
|
You were right, it had nothing to do with sockets.
Here is the offending code:
Assembly assembly = Assembly.GetExecutingAssembly();
DateTime buildDate = File.GetCreationTime(assembly.Location);
...assembly.Location is an empty string when we run the deployed (encrypted) version of the app, and GetCreationTime throws an exception. _________________ Dave |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Feb 15, 2012 9:55 pm Post subject: |
|
|
Since the encrypted assemblies are dynamically loaded they don't actually have a location - so you have to be careful about calls to assembly.Location. You could possibly replace this with:
Code: | Assembly assembly = Assembly.GetEntryAssembly();
DateTime buildDate = File.GetCreationTime(assembly.Location); |
Since the entry assembly (the bootstrapper) will have a location _________________ Infralution Support |
|
Back to top |
|
|
|