Click here to Skip to main content
15,890,741 members
Home / Discussions / C#
   

C#

 
GeneralRe: Colour clicker Pin
Luc Pattyn8-Nov-08 2:53
sitebuilderLuc Pattyn8-Nov-08 2:53 
AnswerRe: Colour clicker Pin
Muammar©8-Nov-08 23:59
Muammar©8-Nov-08 23:59 
QuestionClosing sockets in asynchronous TCP server Pin
Metal767-Nov-08 22:42
Metal767-Nov-08 22:42 
AnswerRe: Closing sockets in asynchronous TCP server Pin
Nicholas Butler8-Nov-08 1:01
sitebuilderNicholas Butler8-Nov-08 1:01 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Metal768-Nov-08 1:10
Metal768-Nov-08 1:10 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Nicholas Butler8-Nov-08 2:39
sitebuilderNicholas Butler8-Nov-08 2:39 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Metal768-Nov-08 23:16
Metal768-Nov-08 23:16 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Nicholas Butler9-Nov-08 3:41
sitebuilderNicholas Butler9-Nov-08 3:41 
Hi Andrea,

I suggested using a reader/writer lock for this reason: in normal operation, the lock is acquired in reader mode. As you can have as many readers as you like at the same time, this does not effect normal operation.

Your problem was that calling Shutdown asynchronously while an EndReceive ( or EndSend ) was executing was throwing nasty exceptions. If you wrap the call to Shutdown in a writer acquire, it is guaranteed that it owns the lock in exclusive mode. This means that the EndXXX methods cannot be executing at the same time as Shutdown, which I think should solve your problem.

So, wrap all 'normal' calls on the Socket in reader acquires, and wrap the call to Shutdown in a writer acquire. Actually, now I think about it, you will probably have to wrap the calls to BeginXXX in reader acquires as well.

Nick

----------------------------------
Be excellent to each other Smile | :)

AnswerRe: Closing sockets in asynchronous TCP server Pin
Mark Salsbery9-Nov-08 7:46
Mark Salsbery9-Nov-08 7:46 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Metal769-Nov-08 9:09
Metal769-Nov-08 9:09 
GeneralRe: Closing sockets in asynchronous TCP server Pin
Mark Salsbery9-Nov-08 9:43
Mark Salsbery9-Nov-08 9:43 
QuestionCan i run windows application in Linux ? Pin
Krishnraj7-Nov-08 22:15
Krishnraj7-Nov-08 22:15 
AnswerRe: Can i run windows application in Linux ? Pin
Perspx7-Nov-08 22:33
Perspx7-Nov-08 22:33 
AnswerRe: Can i run windows application in Linux ? Pin
#realJSOP7-Nov-08 23:56
mve#realJSOP7-Nov-08 23:56 
GeneralRe: Can i run windows application in Linux ? Pin
Krishnraj1-Dec-08 1:46
Krishnraj1-Dec-08 1:46 
AnswerRe: Can i run windows application in Linux ? Pin
Dave Kreskowiak8-Nov-08 5:56
mveDave Kreskowiak8-Nov-08 5:56 
AnswerRe: Can i run windows application in Linux ? Pin
Atif Shahbaz8-Nov-08 6:11
Atif Shahbaz8-Nov-08 6:11 
AnswerRe: Can i run windows application in Linux ? Pin
Paul Conrad8-Nov-08 13:05
professionalPaul Conrad8-Nov-08 13:05 
QuestionAccess to soap WebServer without "Add Web Reference" Option Pin
Patricio Tapia7-Nov-08 22:01
Patricio Tapia7-Nov-08 22:01 
AnswerRe: Access to soap WebServer without "Add Web Reference" Option Pin
Wendelius8-Nov-08 1:05
mentorWendelius8-Nov-08 1:05 
QuestionBackgroundWorker and command line exe: what DoWork deals with? Pin
LordZoster7-Nov-08 20:52
LordZoster7-Nov-08 20:52 
AnswerRe: BackgroundWorker and command line exe: what DoWork deals with? Pin
#realJSOP7-Nov-08 23:58
mve#realJSOP7-Nov-08 23:58 
AnswerRe: BackgroundWorker and command line exe: what DoWork deals with? Pin
Giorgi Dalakishvili8-Nov-08 0:56
mentorGiorgi Dalakishvili8-Nov-08 0:56 
GeneralRe: BackgroundWorker and command line exe: what DoWork deals with? Pin
#realJSOP8-Nov-08 1:59
mve#realJSOP8-Nov-08 1:59 
GeneralRe: BackgroundWorker and command line exe: what DoWork deals with? Pin
LordZoster8-Nov-08 5:42
LordZoster8-Nov-08 5:42 

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.