Click here to Skip to main content
15,898,817 members
Home / Discussions / C#
   

C#

 
AnswerRe: Registry Pin
enginço17-Jul-08 23:38
enginço17-Jul-08 23:38 
GeneralRe: Registry Pin
Simon P Stevens18-Jul-08 1:48
Simon P Stevens18-Jul-08 1:48 
GeneralRe: Registry [modified] Pin
enginço18-Jul-08 2:42
enginço18-Jul-08 2:42 
GeneralRe: Registry Pin
Simon P Stevens18-Jul-08 7:25
Simon P Stevens18-Jul-08 7:25 
QuestionDatabinding dropdown in C# Pin
sabraham17-Jul-08 17:24
sabraham17-Jul-08 17:24 
AnswerRe: Databinding dropdown in C# Pin
nelsonpaixao18-Jul-08 14:58
nelsonpaixao18-Jul-08 14:58 
GeneralRe: Databinding dropdown in C# Pin
sabraham23-Jul-08 12:07
sabraham23-Jul-08 12:07 
QuestionSystem.Net.Socket.Connected --- eek Pin
Jason McBurney17-Jul-08 15:58
Jason McBurney17-Jul-08 15:58 
I am porting a VB6 winsock.ocx based library to a .Net Sockets implementation, and I am not the most savvy sockets programmer. The architecture of the communication system was designed long before I got here; so changing the overall design is not an option. Moreover, this system has a low frequency of tcp traffic, so the Socket.Connected will almost always be out-of-date.

The fundamental issue is the connected property of the socket. It does not seem to be funcitonal; however, I have found others that have had similar issues http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.connected.aspx[^]

When I stepping-through the code in the debugger, unplug the network at the right moment, and view the sock object with the quick watcher, it shows me the value of sock.Connected has changed to false as expected. However, while running the code below, in debug mode but not stepping-through, the behavior of sock.Connected is different (when I unplug the wire, it does not update to false).

Thoughts?

C#
private bool isConnected(){
    bool rVal = false;
    //an alternate way to refresh the connected status of the sock.
    try
    {
        bool blcking = sock.Blocking;
        try
        {
            byte[] junk = new byte[2];
            sock.Blocking = false;
            sock.Send(junk, 1, 0, SocketFlags.None);                         
            rVal = sock.Connected;
        }
        finally
        {
            sock.Blocking = blcking;   
        }

    }
    catch (SocketException e)
    {
        rVal = e.SocketErrorCode == SocketError.WouldBlock;
    }
    return rVal;
}


You can only be young once. But you can always be immature.
- Dave Barry

GeneralRe: System.Net.Socket.Connected --- eek Pin
nelsonpaixao18-Jul-08 15:09
nelsonpaixao18-Jul-08 15:09 
GeneralRe: System.Net.Socket.Connected --- eek Pin
Jason McBurney21-Jul-08 5:55
Jason McBurney21-Jul-08 5:55 
QuestionSigning Data using RSA Pin
nyjcr17-Jul-08 15:10
nyjcr17-Jul-08 15:10 
AnswerRe: Signing Data using RSA Pin
Elroy Dsilva17-Jul-08 17:51
Elroy Dsilva17-Jul-08 17:51 
AnswerRe: Signing Data using RSA Pin
Elroy Dsilva17-Jul-08 17:56
Elroy Dsilva17-Jul-08 17:56 
Question[Message Deleted] Pin
tkrn17-Jul-08 15:07
tkrn17-Jul-08 15:07 
QuestionTranslation vb -> c# Pin
nelsonpaixao17-Jul-08 13:17
nelsonpaixao17-Jul-08 13:17 
Answer[Cross Post]Re: Translation vb -> c# Pin
Scott Dorman17-Jul-08 16:27
professionalScott Dorman17-Jul-08 16:27 
QuestionWebClient.DownloadFileAsync Pin
#realJSOP17-Jul-08 12:06
professional#realJSOP17-Jul-08 12:06 
AnswerRe: WebClient.DownloadFileAsync Pin
N a v a n e e t h17-Jul-08 17:49
N a v a n e e t h17-Jul-08 17:49 
GeneralRe: WebClient.DownloadFileAsync Pin
#realJSOP17-Jul-08 23:16
professional#realJSOP17-Jul-08 23:16 
QuestionC# WinForms: Read/Display Multipage Tiff image. Pin
ImNAM17-Jul-08 10:18
ImNAM17-Jul-08 10:18 
AnswerRe: C# WinForms: Read/Display Multipage Tiff image. [modified] Pin
astanton197818-Jul-08 1:16
astanton197818-Jul-08 1:16 
GeneralRe: C# WinForms: Read/Display Multipage Tiff image. Pin
ImNAM18-Jul-08 3:49
ImNAM18-Jul-08 3:49 
GeneralRe: C# WinForms: Read/Display Multipage Tiff image. Pin
astanton197821-Jul-08 1:35
astanton197821-Jul-08 1:35 
QuestionHow to format a number with an implied decimal Pin
Steve Messer17-Jul-08 8:46
Steve Messer17-Jul-08 8:46 
AnswerRe: How to format a number with an implied decimal Pin
PIEBALDconsult17-Jul-08 9:05
mvePIEBALDconsult17-Jul-08 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.