Volante.Impl.Bytes.pack8 C# (CSharp) Method

pack8() public static method

public static pack8 ( byte arr, int offs, long val ) : void
arr byte
offs int
val long
return void
        public static unsafe void pack8(byte[] arr, int offs, long val)
        {
            fixed(byte* p = &arr[offs])
            {
                *(long*)p = val;
            }
        }

Usage Example

        public virtual void Write(long pos, byte[] buf)
        {
            for (int i = 0; i < sockets.Length; i++)
            {
                while (sockets[i] != null)
                {
                    try
                    {
                        Bytes.pack8(txBuf, 0, pos);
                        Array.Copy(buf, 0, txBuf, 8, buf.Length);
                        sockets[i].Send(txBuf);
                        if (!ack || pos != 0 || sockets[i].Receive(rcBuf) == 1)
                        {
                            break;
                        }
                    }
                    catch (SocketException) { }

                    sockets[i] = null;
                    nHosts    -= 1;
                    if (HandleError(hosts[i]))
                    {
                        connect(i);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            file.Write(pos, buf);
        }
All Usage Examples Of Volante.Impl.Bytes::pack8