TReKiE / msnp-sharp

Automatically exported from code.google.com/p/msnp-sharp
0 stars 0 forks source link

Please put try/catch around SendSocketData() -- if the network is not available an SocketEception is thrown. #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Please put a try/catch around the SendSocketData in NSMessageProcessor and
SBMessageProcessor.. once you catch the exception you can call
OnEexceptionOccured so we can capture and handle the event with a handler.

  \MSNPSharp\NSMessageProcessor.cs(97): 
SendSocketData(message.GetBytes());
  \MSNPSharp\SBMessageProcessor.cs(138):
SendSocketData(sbMessage.GetBytes());       

The reason for this is because my internet connection can be intermittent
and it would be nice to be able to capture this exception with and event
instead of the exception have to be pushed-up to other layers of my
application that should not be coupled to MSNPSharp.

System.Net.Sockets.SocketException: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Send(Byte[] buffer)
   at MSNPSharp.Core.SocketMessageProcessor.SendSocketData(Socket psocket,
Byte[] data)
   --- End of inner exception stack trace ---
   at MSNPSharp.Core.SocketMessageProcessor.SendSocketData(Socket psocket,
Byte[] data)
   at MSNPSharp.Core.SocketMessageProcessor.SendSocketData(Byte[] data)
   at MSNPSharp.NSMessageProcessor.SendMessage(NetworkMessage message,
Int32 transactionID)
   at MSNPSharp.NSMessageProcessor.SendMessage(NetworkMessage message)
   at MSNPSharp.NSMessageHandler.SetScreenName(String newName)
   at MSNPSharp.ContactService.SetDefaults()
   at MSNPSharp.ContactService.<SynchronizeContactList>b__1(Object ,
ABFindContactsPagedCompletedEventArgs )
   at MSNPSharp.ContactService.<>c__DisplayClass10.<abRequest>b__d(Object
sender, ABFindContactsPagedCompletedEventArgs e)
   at
MSNPSharp.MSNWS.MSNABSharingService.ABServiceBinding.OnABFindContactsPagedOperat
ionCompleted(Object
arg)

Original issue reported on code.google.com by johnpaul...@gmail.com on 28 May 2009 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by freezing...@gmail.com on 2 Jun 2009 at 7:02