TrotiNet.HttpSocket.WriteBinary C# (CSharp) Method

WriteBinary() public method

Write an array of bytes to the socket
public WriteBinary ( byte b ) : uint
b byte
return uint
        public uint WriteBinary(byte[] b)
        {
            return WriteBinary(b, 0, (uint)b.Length);
        }

Same methods

HttpSocket::WriteBinary ( byte b, uint nb_bytes ) : uint
HttpSocket::WriteBinary ( byte b, uint offset, uint nb_bytes ) : uint

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Transfer data from this socket to the destination socket
        /// until this socket closes
        /// </summary>
        /// <returns>The number of bytes sent</returns>
        public uint TunnelDataTo(HttpSocket dest)
        {
            uint total_sent = 0;

            try
            {
                if (AvailableData == 0)
                {
                    ReadRaw();
                }
                while (AvailableData > 0)
                {
                    uint sent = dest.WriteBinary(Buffer, BufferPosition,
                                                 AvailableData);
                    if (sent < AvailableData)
                    {
                        throw new IoBroken();
                    }
                    total_sent += sent;
                    ReadRaw();
                }
            }
            catch (SocketException) { /* ignore */ }

            return(total_sent);
        }
All Usage Examples Of TrotiNet.HttpSocket::WriteBinary