Home Forums Support Unhandled Exeption in Xamarain Mono 3.1 when sending simple message to server

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #2754

    recently I both a license of your library V3. I want to make a Android application which sends shortTCP messages to a Windows 7 based TCP Server.
    In my Mon Project I used for test following easy code

    ` using NetworkCommsDotNet;
    public string serverIP = “”;
    public int serverPort = 8888;
    public string messageToSend =”START”
    NetworkComms.SendObject(“Message”, serverIP, serverPort, messageToSend);`

    When debuging from a Samsung Tablet I always get the following unhandled exeption:

    NetworkCommsDotNet.CommunicationException: System.ObjectDisposedException: The object was used after being disposed.
      at System.Net.Sockets.NetworkStream.CheckDisposed () [0x0000b] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:431 
      at System.Net.Sockets.NetworkStream.EndWrite (IAsyncResult ar) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:335 
      at NetworkCommsDotNet.Tools.StreamTools+<>c__DisplayClass2.<Write>b__1 (IAsyncResult ar) [0x00014] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\StreamTools.cs:166 

    What does this means? I am not very expirienced in C# and Mono until now. Thank you very much for any help in this Situation.

    Best Regards André

    • This topic was modified 9 years, 9 months ago by . Reason: Added code tags

    Have you been able to try the same code on a different android device? If you could provide a full example that we could download and test ourselves that would be greatly appreciated.



    Hi Marc,
    I tried to debug on a Samsung S9300, but results are the same. The unhandled exeption remains.
    What does this means c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\StreamTools.cs:166. I develop in VB2012 and not VB 2010.
    The Networkcomms library is installed on a Drive D:
    My Server application is a VB based application where I use TCP Sockets from Dart. But I think, this should made no difference which Client application connects to it. Follow the link where you can find a of my Trial.

    Thanks for further help



    • This reply was modified 9 years, 9 months ago by . Reason: Fixed link

    Dear André,

    The problem appears to be that you are trying to connect NetworkComms.Net to a third party network library. This is supported but please note that you loose a lot of the awesome features and simplicity that NetorkComms.Net offers. To connect to a third party library you must used ‘Unmanaged Connections’. Please see the example, UnmanagedConnectionExample.cs, included when you downloaded our network library which demonstrates how this works.

    Kind regards,


    NetworkComms should update the component from Xamarin. If you try and mix the 2.x version component (which is still available via Xamarin) and 3.x you’ll get this error. Also, the protobuf dll that shipped with version 3.x is wrong for android (I had to use nuget to add the correct one).

    • This reply was modified 9 years, 7 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.