Sami_codes_AllDay's Profile User Rating: -----

Reputation: 2 Apprentice
Active Posts:
41 (0.02 per day)
09-August 11
Profile Views:
Last Active:
User is offline Jan 12 2016 06:02 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:
Icon   Sami_codes_AllDay If you're not confused and scratching your head, then you're not tackling difficult enough problems...

Posts I've Made

  1. In Topic: An unhandled exception of type 'System.Windows.Markup.XamlParseExc

    Posted 13 May 2015

    Thank you for your helpful advice tlhIn. Not to worry, I was not leaving the socket open indefinitely. I have two event handlers, one which creates the socket once the window opens and one which tears down the socket once the window closes. Yes, it's not the recommended paradigm for socket usage, however, it's what is needed for my specific application. Within this same thread, I'm having a difficult time trying to pass the socket around and give full visibility to the socket among my existing classes.

    In other words, how do I allow 3 separate classes (all within the same namespace), to listen to and write to the same socket? I've done a lot of reading behind the subject (using a Singleton object seemed to be the most prevalent way around this, although being a new at C#, I couldn't quite get the Singleton right). Here is a pertinent snippet of the code:

    namespace Original_Remote_Monitor
        // Assume socket was successfully opened.  
        public class myServer
            // Establish the remote endpoint for the socket.
            // myServer uses port 27015 and IP address "".
            public IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(""), 27015);
            // Create a TCP/IP socket.
            public Socket theSender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            public void writeToMyServer(IPEndPoint EP, Socket Client)
              // This method works fine as the socket is "visible" to the method.
        } // End of myServer.
        public class myDevice_A
            public void writeToDeviceA (IPEndPoint EP, Socket Client)
              // This method cannot write to the socket, although the socket was previously opened!
        } // End of myDevice_A.
        public class myDevice_B
           public void writeToDeviceB (IPEndPoint EP, Socket Client)
               // This method cannot write to the socket, although the socket was previously opened!
        } // End of myDevice_B.
    } // End of namespace

    Thank you,

  2. In Topic: An unhandled exception of type 'System.Windows.Markup.XamlParseExc

    Posted 8 May 2015

    Thank you tlhIn. I went ahead and did as you prescribed. The exception is being thrown in my "SpiWrite()" method within the class "SerialComm".

    "A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
    Additional information: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied."

    This exception is a bit confusing as I opened the Socket within the "MainWindow()" method (line 120) and perform a check to see that the socket is indeed opened. I can confirm that the socket is open (in theory) by viewing the traffic with my hyper-terminal link. I'll go ahead and check the downstream buffer to see if the array "buffer" is stepping out of bounds, although figured that .net would bark at me if I was stepping out of bounds in an array.

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown
Years Programming:
Programming Languages:
C/C++, C#, Python, PERL, Matlab

Contact Information

Click here to e-mail me


Sami_codes_AllDay has no profile comments yet. Why not say hello?