Click here to Skip to main content
15,908,909 members
Home / Discussions / C#
   

C#

 
GeneralRe: reseting forms Pin
shwaguy22-Jul-08 9:00
shwaguy22-Jul-08 9:00 
QuestionFingerPrint readers Pin
Dirso21-Jul-08 10:09
Dirso21-Jul-08 10:09 
AnswerRe: FingerPrint readers Pin
Bert delaVega21-Jul-08 17:11
Bert delaVega21-Jul-08 17:11 
QuestionWord Processing (Office 2007) for .NET Pin
JPWheeler21-Jul-08 9:07
JPWheeler21-Jul-08 9:07 
AnswerRe: Word Processing (Office 2007) for .NET Pin
Thomas Stockwell21-Jul-08 9:31
professionalThomas Stockwell21-Jul-08 9:31 
AnswerRe: Word Processing (Office 2007) for .NET Pin
Green Fuze21-Jul-08 12:24
Green Fuze21-Jul-08 12:24 
Questionconvert the pdf file to txt file Pin
Member 226808621-Jul-08 7:38
Member 226808621-Jul-08 7:38 
AnswerRe: convert the pdf file to txt file Pin
DaveyM6921-Jul-08 8:34
professionalDaveyM6921-Jul-08 8:34 
QuestionWeb service calling business logic Pin
Gktony21-Jul-08 6:39
Gktony21-Jul-08 6:39 
AnswerRe: Web service calling business logic Pin
leppie21-Jul-08 14:49
leppie21-Jul-08 14:49 
GeneralRe: Web service calling business logic Pin
Gktony21-Jul-08 20:53
Gktony21-Jul-08 20:53 
QuestionImplementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 6:16
Christopher Duncan21-Jul-08 6:16 
AnswerRe: Implementing IWebBrowser2 on WebBrowser control? Pin
led mike21-Jul-08 6:59
led mike21-Jul-08 6:59 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 7:12
Christopher Duncan21-Jul-08 7:12 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
led mike21-Jul-08 7:40
led mike21-Jul-08 7:40 
GeneralRe: Implementing IWebBrowser2 on WebBrowser control? Pin
Christopher Duncan21-Jul-08 8:24
Christopher Duncan21-Jul-08 8:24 
QuestionSystem.Net.Socket.Connected Pin
Jason McBurney21-Jul-08 5:58
Jason McBurney21-Jul-08 5: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?


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

AnswerRe: System.Net.Socket.Connected Pin
led mike21-Jul-08 7:16
led mike21-Jul-08 7:16 
GeneralRe: System.Net.Socket.Connected Pin
DaveyM6921-Jul-08 8:14
professionalDaveyM6921-Jul-08 8:14 
AnswerRe: System.Net.Socket.Connected Pin
nelsonpaixao21-Jul-08 13:10
nelsonpaixao21-Jul-08 13:10 
Questionstructured storage API Pin
Miss_hacker21-Jul-08 5:58
Miss_hacker21-Jul-08 5:58 
AnswerRe: structured storage API Pin
led mike21-Jul-08 6:57
led mike21-Jul-08 6:57 
GeneralRe: structured storage API Pin
Miss_hacker21-Jul-08 7:53
Miss_hacker21-Jul-08 7:53 
GeneralRe: structured storage API Pin
led mike21-Jul-08 7:59
led mike21-Jul-08 7:59 
GeneralRe: structured storage API Pin
DaveyM6921-Jul-08 8:21
professionalDaveyM6921-Jul-08 8:21 

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.