// 헤더 필드를 뒤집어 씀. // test완료 public void setHeader(TcpHeader head) { IntPtr ptr = Marshal.AllocHGlobal(m_headsize); Marshal.StructureToPtr(head, ptr, true); Marshal.Copy(ptr, m_field, 0, m_headsize); Marshal.FreeHGlobal(ptr); }
public void setHeadLenByIndex() { TcpHeader head = new TcpHeader(); head.mode = this.getheader().mode; head.msgsize = (uint)this.m_index; this.setHeader(head); }
//헤더필드 바이트를 형변환후 리턴 // test완료 public TcpHeader getheader() { IntPtr ptr = Marshal.AllocHGlobal(m_headsize); Marshal.Copy(m_field, 0, ptr, m_headsize); TcpHeader head = (TcpHeader)Marshal.PtrToStructure(ptr, typeof(TcpHeader)); Marshal.FreeHGlobal(ptr); return(head); }