Initiated messages in both directions - blocking?

May 2, 2012 at 12:46 AM

I have a socket app that we've built that is generally working well.  Both sides can initiate a message, be it the server or the client so to speak.  If it gets really busy it will lock up. For instance, if I hit break in visual studio, it may be at line   For instance, in line 61 in SocketEx.cs, at the client.Send.

Is this notion flawed that I can initiate in both directions flawed on the same socket. I've thought I should just bite the bullet and add another socket and use one for sending messages, and one for receiving messages. 

Thoughts?

Thanks.

 

   public static void SendData(this Socket client, byte[] data, int offset, int length)
        {
            int sent = 0;
            int thisSent = 0;

            while ((length - sent) > 0)
            {
                thisSent = client.Send(data, offset + sent, length - sent, SocketFlags.None);
                sent += thisSent;
            }
        }

Coordinator
May 2, 2012 at 2:58 AM

It is not because of socket layer. It is designed by SuperSocket. After one command is excuted, then the server will start receiving from the client for the session.

May 2, 2012 at 1:22 PM

Ok.  So now how do I rework my solution to avoid this lockup?

Coordinator
May 2, 2012 at 3:51 PM

Execute your code in command asynchronously