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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
G

Grimes

@Grimes
About
Posts
67
Topics
20
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • TcpClient - Detecting closed connections
    G Grimes

    You make a very good point.

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • TcpClient - Detecting closed connections
    G Grimes

    Yes this will be VERY useful! Thanks!

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • TcpClient - Detecting closed connections
    G Grimes

    Thanks for the reply. It seems to me then that the way I am currently doing is probably the best way to detect the closed connection due to errors. I would then just have to accept that I need to wait for the connection to time out. I will add a check to check what the result is of an read, to see if the remote client actively closed. Thanks for the help.

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • TcpClient - Detecting closed connections
    G Grimes

    I had a look at my initial post. I did not clearly state the nature of the problem. The problem is that I am having trouble detecting when the remote connection closes on it's side of the connection. It seems like your answer is on detecting when the connection closed on my side of the connection, or it seems that way. If there was any confusion, I apologize since I was not more clear on the nature of the problem in the initial post... Thanks for the replies though. :)

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • TcpClient - Detecting closed connections
    G Grimes

    Hi thanks for the reply. You say your library catches SocketException and also ObjectDisposedException and treat that as an indication that the connection has closed. When does these exceptions get thrown? When you send data? Say for example I am connected to a remote computer. If his connection closes abruptly, under which conditions will these exceptions get thrown on my machine? Would .Net eventually close\dispose my connection if the connection was closed on the remote machine? I was not aware that it worked that way, maybe I misunderstood what you meant.

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • TcpClient - Detecting closed connections
    G Grimes

    Hello there. I am currently writing a server and client application. I have code that can handle it when client users close their connection, however detecting when the connection has closed due to an error is a completely different story. What is the best way to do this? I had a look at the forum and found similar questions. One of these propose that I use the Linger and Time Out properties of TCPClient to determine whether the connection is still open. What I read from MSDN about these properties are that they determine the time that write/read operations may wait to complete. To me this does not seem like a good way to test the connection, because shortening these times might close connections when in actual fact the remote connection hasn't disconnected but is merely very busy. Am I wrong? Is my understanding of lingering and time outs correct? Another solution proposes that I use polling to determine whether the connections are open. This is actually what I am currently doing. My server has a thread that every once in a while sends a small piece of test data to every connection. I then try and catch the IOException exceptions that are thrown when I send data to a connection that closed at the client side. This seems to work for the most part, however, it does not throw immediately when I send the test data, it seems to throw randomly on the 2nd or 3rd set of test data. Only after it has thrown does the server's TCPCLient.Connected property change to false. How can I get the connection to immediately throw the exception? Could there be a better way to fix this and to see if the connection has closed? Any Help is appreciated Thanks!

    KOM UIT DAAAAA!!!

    C# help question sysadmin

  • virtual USB device
    G Grimes

    This is an interesting approach to the problem I am having. I found C# libraries to interact with existing devices, I could try to forward all the Data that is sent to a card reader to our simulator. It's kind of a hack but it could work! Thanks for the reply!

    KOM UIT DAAAAA!!!

    C# csharp json help question

  • virtual USB device
    G Grimes

    Thanks for the Reply. I actually stumbled onto the same program, so I am also convinced it must be possible, but how remains the big question :)

    KOM UIT DAAAAA!!!

    C# csharp json help question

  • virtual USB device
    G Grimes

    Hi, thanks for the reply. That project looks very interesting, however it seems like they use a cellphone or some other mobile device that runs the emulation software, it seems like it is only a replacement for an actual smart card reader, so this is not exactly what I am looking for. thanks for the reply though.

    KOM UIT DAAAAA!!!

    C# csharp json help question

  • virtual USB device
    G Grimes

    Hi there I am currently looking for help in writing a C# application that would 'trick' the OS into thinking there is a USB device connected. I would like to know if this is even possible and whether it is even possible in C#. Well, I'll explain in greater detail what I am trying to do. The company I work for has bought software that interfaces with USB devices (Smart card readers), we develop smart cards, and we also have several applications that simulate smart cards to test with. It would help us a lot if it was possible to let the software we bought interface with our simulators instead of the smart card readers. This is unfortunately not possible, their software can't be configured to communicate with anything other than smart card readers. I am hoping it is possible to create an application that is a virtual smart card reader, and this application would relay all the data their software sends to the virtual card reader to our simulator. (is this possible or am I living in a dream world?? which I tend to do a lot :) ). If this is possible, can it be done in C# or will I have to use WIN API calls? I have found many C# projects that have classes to communicate with USB devices, but I have not found any that emulates a USB device. Any help will be greatly appreciated or if you can point me to reading material regarding the matter, that will also help me a lot. :) Regards Riaan

    KOM UIT DAAAAA!!!

    C# csharp json help question

  • WebBrowser Control not displaying
    G Grimes

    After searching the web, I found a way to fix this. I just thought that I need to add it here to maybe help the next guy (or gal). The solution I found best is to use a wrapper around the WebBrowser control. Here is an example webbrowser-control-on-transparent-wpf-window There were other possible solutions but they either did not work or had bugs. here is a link to one of them: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/17fc75f6-db97-43ef-8ce5-f1aecaa15f86

    KOM UIT DAAAAA!!!

    WPF help csharp wpf tutorial

  • WebBrowser Control not displaying
    G Grimes

    Hi I am having trouble displaying a WebBrowser control in my WPF application. The control seems to be invisible. The WebBrowser is on my main form. The main form has a non rectangular shape, so it basically is a PNG image I use as the background, which also has a alpha channel. To enable the alpha channel I had to set the 'AllowsTransparent' property to true, but when I do this the WebBrowser Control turns invisible. I can see that it is only invisible since the mouse pointer still changes when I move my mouse over it, but the control it self is invisible. I have changed some settings and I have seen that this is definitely caused by the 'AllowsTransparent' setting. I don't want to change this setting since turning it off removes the alpha channel from my PNG background. Any help or ideas on how to fix this would be appreciated. Maybe there is another way to use the alpha channel or some other WebBrowser control. thanks in advance

    KOM UIT DAAAAA!!!

    WPF help csharp wpf tutorial

  • Get rich quick - need advice
    G Grimes

    Haha lol, ek het nie eers daaraan gedink nie!

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    LOL just saw now that you are also from SA. Don't think other people know what muti is, but there is a lot of money in that!

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    that gives me at least 1 kidney, 1 lung and parts of my liver (I think your liver regenerates!). Better yet, I could sell someone else' organs, less painful.

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    LOL!

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    I have actually won the Spanish lottery several times (without even entering), I just need to send them my bank details!

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    Yes, that's all I am good for, because when it comes to programming I fall short... :(

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    Studeer hard aan kernteorie en fisika sodat jy n tydmasjien kan maak! Right back at you, some language also close to dutch...

    KOM UIT DAAAAA!!!

    The Lounge help tutorial

  • Get rich quick - need advice
    G Grimes

    Yes those guys made lots of money, but the market must be saturated by now...

    KOM UIT DAAAAA!!!

    The Lounge help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups