Open Marcpellet opened 8 years ago
I'm also using openfire 4.0.2 on Win 2012 R2 an it's working fine (but mine are named the same). I might have some free time to check this when I get home.
As a temporary fix you could modify your hosts file so that your machine domain matches your server name.
Are you if sure this is happening in EstablishSession() on connect and not on authenticate? I've had to make my harness ignore exceptions from authenticate and then double check it is authenticated to be able to get around a stream termination bug.
Also could you post a pastebin of the exception details? It might be of help us solve this.
Thanks for your answer
here is the complete stack trace:
L'exception S22.Xmpp.XmppErrorException n'a pas été gérée
HResult=-2146233088
Message=Session establishment failed.
Source=S22.Xmpp
StackTrace:
à S22.Xmpp.Im.XmppIm.EstablishSession()
à S22.Xmpp.Im.XmppIm.Connect(String resource)
à S22.Xmpp.Client.XmppClient.Connect(String resource)
à testSharpXmpp.Program.sendMessages(String hostname, String username, String password, String recipient) dans c:\Users\Marc\Documents\Cours\test c#\testSharpXmpp\testSharpXmpp\Program.cs:ligne 78
à testSharpXmpp.Program.Main(String[] args) dans c:\Users\Marc\Documents\Cours\test c#\testSharpXmpp\testSharpXmpp\Program.cs:ligne 52
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
Oups i didn't notice I had an old version on my test project, I changed to the last library release and the exception persist:
L'exception Sharp.Xmpp.XmppErrorException n'a pas été gérée
HResult=-2146233088
Message=Session establishment failed for Hostname: marcpc
Source=Sharp.Xmpp
StackTrace:
à Sharp.Xmpp.Im.XmppIm.EstablishSession() dans c:\Users\Marc\Documents\Cours\BA6\TB\sharp.xmpp\Sharp.Xmpp\Im\XmppIm.cs:ligne 1528
à Sharp.Xmpp.Im.XmppIm.Connect(String resource) dans c:\Users\Marc\Documents\Cours\BA6\TB\sharp.xmpp\Sharp.Xmpp\Im\XmppIm.cs:ligne 372
à Sharp.Xmpp.Client.XmppClient.Connect(String resource) dans c:\Users\Marc\Documents\Cours\BA6\TB\sharp.xmpp\Sharp.Xmpp\Client\XmppClient.cs:ligne 655
à testSharpXmpp.Program.sendMessages(String hostname, String username, String password, String recipient) dans c:\Users\Marc\Documents\Cours\test c#\testSharpXmpp\testSharpXmpp\Program.cs:ligne 78
à testSharpXmpp.Program.Main(String[] args) dans c:\Users\Marc\Documents\Cours\test c#\testSharpXmpp\testSharpXmpp\Program.cs:ligne 52
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
Well i had same issue and solved it by modifying Library source code. Basically cause for the issue is Library could not able to do "Session Establishment" [XMPP RFC 3921, Section 3] if Host name and Server Name is different.
To solve, i suggest you to do following modification in Library source code.
This is quite a significant bug and i'm surprised not to have seen this more. Thanks for the tip - i will fork and mod the source.
Any updates on this? What is this Server Name?
nairbijesh - can you please post the actual code for the necessary change?
Thanks, Steve
@stevenlivz actually have done a nice job to fix this. See #41. Unfortunately there is no published package using this modification. I have asked permission for @stevenlivz to fork his mod in order to publish and maintain it. I'm still getting into the source code but soon it will be published.
Hello
I use openfire 4.0.2 on windows 7 and sharp.xmpp to communicate with the server. Everything worked fine during the testing phase when i used the same name for hostname and server name. I used the example of xmpp connection found in the documentation.
I tried to reinstall the server using a different name for server name and I am unable to connect to the server. The instruction client.connect() rise an exception of type: Exception:Sharp.Xmpp.XmppErrorException: Session establishment failed.
I saw that issue #9 already talks about this exception and tried to enable log plugin to have more information about the bug, but logs are totally unreadable.
Is there any special configuration to change when both server and host name are different or did I miss something ?