示例#1
0
            public void Sender(CoreTcpClient client)
            {
                if (Size <= 0)
                {
                    Size = 0;
                    return;
                }
                unsafe
                {
                    int start = 0;
                    fixed(byte *ptr = &Buffers[0])
                    {
                        while (Size > 0)
                        {
                            if (client.mConnected == false)
                            {
                                Size = 0;
                                break;
                            }
                            int sendSize = client.Send(&ptr[start], (UInt32)Size);
                            if (sendSize == -1)
                            {
                                client.Disconnect(true);
                                Size = 0;
                                break;
                            }
                            Size  -= sendSize;
                            start += sendSize;
                        }
                    }

                    System.Diagnostics.Debug.Assert(Size == 0);
                }
            }
示例#2
0
 public CTcpClient()
 {
     mClient = new CoreTcpClient(this);
 }