pgstath / Sharp.Xmpp

Sharp.Xmpp is looking for a maintainer! Unfortunatelly I do not have currently the time needed to maintain the library. Luckily a small but vibrant community has evolved around Sharp.Xmpp. If you would like to be the project's maintainer please sent an email to pgstath@gmail.com. This should include issues, tickets and commits that you have done for Sharp.Xmpp or other similar project. Sharp.Xmpp is a multiplatform, Windows and Android, .NET XMPP client assembly.Sharp.Xmpp supports IM functionality & a variety of XMPP extensions, is simple and is extensively tested against Android Xamarin. It is a fork of the currently frozen excellent S22.Xmpp project. Sharp.Xmpp will be at the FOSSDEM 2016 Real time DevRoom!
Other
84 stars 51 forks source link

Hi.. Receiving msg #10

Closed mirkarpude closed 8 years ago

mirkarpude commented 8 years ago

as I m new please show me how to receive a message using sharp.xmpp.client. from recipient

In documentation there is coding example for send not for receiving please guide me

pgstath commented 8 years ago

Hi, This is handled with Event Handlers. You should use the public event EventHandler<MessageEventArgs> Message event. E.g. if _xmppClient is your XmppClient instance then _xmppClient.Message += yourMessageHandler will do the trick. Depending on your application this should be inside a shorts of loop from the receiving side.

mirkarpude commented 8 years ago

Dear pgstath If u have time please give me small small from begin for receiving msg in chat application

mirkarpude commented 8 years ago

Dear sir I tried, now receiving msg. but an error is there 1) Exception Message "A blocking operation was interrupted by a call to WSACancelBlockingCall"

2) Exception Message "A blocking operation was interrupted by a call to WSACancelBlockingCall" in streamParser.cs

3) + Caught: "Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall." (System.IO.IOException) Exception Message = "Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall.", Exception Type = "System.IO.IOException", Exception WinRT Data = "" in XmppCore.cs > ReadXMLStream.. DispatchEvents

pgstath commented 8 years ago

What is the environment that your application is targeting? Also if you could attach a sample of source code this could be helpful.

mirkarpude commented 8 years ago

Dear pgstath. Actually I was tested your code. Its good

I want to buil android xmpp jabber app to receive notifications from any windows and web software. Now its working fine in windows. Pls guide me to use your code in xamarin android and ios

pgstath commented 8 years ago

Good to learn this! I will share a post about using Sharp.Xmpp in Android. Sharp.Xmpp is extensively tested in Android, but not in iOS. Nothing particular is needed, just add the code in your Xamarin application. I wll let you know when some update is ready

Linkinleged commented 8 years ago

Dear pgstath,

I have a problem when implementing the code for receiving messages in my Xamarin Android project. In a console application it works fine, but in my android application, it will not reach my eventhandler. I have set up the eventhandler before I connect.

tewarid commented 7 years ago

I am seeing a similar issue but with .NET framework on Windows. I have created an XmppClient and am listening for messages by subscribing to Message event. At the other end, I have Pidgin send a message. The event handler is not invoked. If I send a message to Pidgin first, then send a message from Pidgin, the event handler is invoked. Any thoughts on why I need to send a message to start receiving messages?

Update: The messages were probably not being delivered because I had another instance of Pidgin logged in with the same user as XmppClient. Tried again after quitting that instance of Pidgin and receiving message works.