473,738 Members | 11,192 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Marshalled structure size

Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or classes.
I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and 10+15
for the strings). Now, when I debug my source code, the compiler gives me
this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ? To make it
work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size instead
of hard coding it... Does anyone knows why this happens and what I should do
to make it works correctly ?

Thanks !
Nov 30 '05 #1
6 5016
Hi,

Take a look at the Pack parameter for the StructLayoutAtt ribute class.
It specifies the packing size: the alignment of the structure. By
default that should be 4 or 8. This would mean for 29 both cases would
return 32.

Try setting it to 1 if you require exactly the size your elements take up.

-Lenard

Laurent wrote:
Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or classes.
I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and 10+15
for the strings). Now, when I debug my source code, the compiler gives me
this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ? To make it
work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size instead
of hard coding it... Does anyone knows why this happens and what I should do
to make it works correctly ?

Thanks !

Nov 30 '05 #2
\o/

Great, thank you for your answer, Lenard !

"Lenard Gunda" <ar***********@ freemail.hu> a écrit dans le message de news:
e0************* *@tk2msftngp13. phx.gbl...
Hi,

Take a look at the Pack parameter for the StructLayoutAtt ribute class. It
specifies the packing size: the alignment of the structure. By default
that should be 4 or 8. This would mean for 29 both cases would return 32.

Try setting it to 1 if you require exactly the size your elements take up.

-Lenard

Laurent wrote:
Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or
classes. I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and
10+15 for the strings). Now, when I debug my source code, the compiler
gives me this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ?
To make it work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size
instead of hard coding it... Does anyone knows why this happens and what
I should do to make it works correctly ?

Thanks !

Nov 30 '05 #3
What exactly do you mean with:
"To make it work, I had to modify the declaration of my class like this:
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]

Your code works without the size attribute too!

The 32 comes from the fact that the interop marshaler reserves a buffer for
the structure that is the size of the structure padded to a multiple of the
size of the first element in the structure.
So in your case 4 +10+15 = 29 padded to a multiple of 4 which gives you 32.
This buffer size is only relevant for the marshaler, you shouldn't care
about it, what counts is that the structure is correctly marshaled to the
native side, that is, correctly aligned and padded.

Note that it's your responsability to balance the alignment of the
structures you pass to unmanaged code.

Willy.

"Laurent" <mo********@fre e.fr> wrote in message
news:u3******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or classes.
I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and
10+15 for the strings). Now, when I debug my source code, the compiler
gives me this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ?
To make it work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size instead
of hard coding it... Does anyone knows why this happens and what I should
do to make it works correctly ?

Thanks !

Nov 30 '05 #4
Hi Willy,
Thanks for your answer. When I say that the code does not work without
the size attribute, it's because I use this class as a parameter for a
function embeded in a C++ DLL, which return me a array of my class (using
double pointers).

So to read this array, I use the pointer returned by the function and,
with the exact size of the array which must be the same as the array
returned by the DLL, I can put element by element the values (I'm not sure
to be undersandable enough, but thanks to Nicholas Paldino for this tip).

That's why I need to have 29, not 32 ! :-)

"Willy Denoyette [MVP]" <wi************ *@telenet.be> a écrit dans le message
de news: %2************* ***@tk2msftngp1 3.phx.gbl...
What exactly do you mean with:
"To make it work, I had to modify the declaration of my class like this:
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]

Your code works without the size attribute too!

The 32 comes from the fact that the interop marshaler reserves a buffer
for the structure that is the size of the structure padded to a multiple
of the size of the first element in the structure.
So in your case 4 +10+15 = 29 padded to a multiple of 4 which gives you
32.
This buffer size is only relevant for the marshaler, you shouldn't care
about it, what counts is that the structure is correctly marshaled to the
native side, that is, correctly aligned and padded.

Note that it's your responsability to balance the alignment of the
structures you pass to unmanaged code.

Willy.

"Laurent" <mo********@fre e.fr> wrote in message
news:u3******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or
classes. I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and
10+15 for the strings). Now, when I debug my source code, the compiler
gives me this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ?
To make it work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size instead
of hard coding it... Does anyone knows why this happens and what I should
do to make it works correctly ?

Thanks !


Nov 30 '05 #5
Lauren,

It shouldn't matter, there must be something wrong in the way you fill the
structure in your C code.

If you consider the buffer (array) filled with structures
"ListeCommandes XComm", like this:

|------------->|------------>|-------------->
struct1 struct2 struct3

where (in your case), each struct takes 29 bytes, this means that each odd
index (int) element would be mis-aligned on an odd address, something that
is taken care off by the CLR and the JIT on 32 bit versions of the OS, but
this would fail on some 64 bit systems!
I would suggest you inspect the C code and check how the array gets filled.
My guess is that:
- Your packing is set to 1 for the compiland, or....
- that structures are getting copied (using memcpy) to addresses in a buffer
calculated using the length of the structure as displacement value. This
leads to non-portable code and a lot of maintenance issues, especially when
you have to transport the buffer to non C code applications.

Take a look at the following sample (try to compile and run it if you like),
you'll see it works with the SizeOf value returned from the marshaler using
the default C++ alignment, but it will fail when the alignment is set to
anthing other than 4, 8, 16, 32.

//compile using MSFT C++: cl /EHsc /LD strmarsh.cpp
#include <windows.h>
// try this, align to byte (one byte multiples) and see the program fail
// __declspec(alig n(1)) struct str
// using default alignment
struct str
{
int index;
char num[10];
char dat[15];
};

extern "C" {
__declspec( dllexport ) void __stdcall PassStructArr(s tr *st[], int
*number);

}

str *st;
#define SIZEOFARRAY 5
void __stdcall PassStructArr(s tr *strarr[], int *number)
{
st = new str[SIZEOFARRAY];
for(int i = 0; i < SIZEOFARRAY; i++)
{
st[i].index = i;
strcpy( st[i].num, "123456789" );
strcpy( st[i].dat, "12345678901234 " );
}
*strarr = st;
*number = SIZEOFARRAY;
}
using System;
using System.Runtime. InteropServices ;
namespace Willys
{
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)]
public string numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)]
public string dateCommande;
}

class Tester
{

[DllImport("strm arsh")]
extern static void PassStructArr(o ut IntPtr pt, out int number);

static void Main()
{
IntPtr lc = IntPtr.Zero;
int number;
PassStructArr(o ut lc, out number);
// Allocate the array.
ListeCommandesX Comm[] outStructs = new ListeCommandesX Comm[number];
// snippet taken from Nicholas reply on the other thread...
// Cycle through unmanaged memory, and marshal.
for (int index = 0; index < number; index++)
{
// Get the pointer of the location in memory.
IntPtr elementPointer = new IntPtr(lc.ToInt 64() + (index *
Marshal.SizeOf( typeof(ListeCom mandesXComm)))) ;
// Now marshal that value.
outStructs[index] =
(ListeCommandes XComm)Marshal.P trToStructure(e lementPointer,
typeof(ListeCom mandesXComm));
}
DumpArray(outSt ructs);
}
static void DumpArray(Liste CommandesXComm[] outStructs)
{
foreach(ListeCo mmandesXComm lc in outStructs)
Console.WriteLi ne("index {0}, numero {1}, date {2}", lc.index,
lc.numeroComman de, lc.dateCommande );

}
}
}
Willy.
"Laurent" <mo********@fre e.fr> wrote in message
news:Ou******** ******@tk2msftn gp13.phx.gbl...
Hi Willy,
Thanks for your answer. When I say that the code does not work without
the size attribute, it's because I use this class as a parameter for a
function embeded in a C++ DLL, which return me a array of my class (using
double pointers).

So to read this array, I use the pointer returned by the function and,
with the exact size of the array which must be the same as the array
returned by the DLL, I can put element by element the values (I'm not sure
to be undersandable enough, but thanks to Nicholas Paldino for this tip).

That's why I need to have 29, not 32 ! :-)

"Willy Denoyette [MVP]" <wi************ *@telenet.be> a écrit dans le
message de news: %2************* ***@tk2msftngp1 3.phx.gbl...
What exactly do you mean with:
"To make it work, I had to modify the declaration of my class like this:
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]

Your code works without the size attribute too!

The 32 comes from the fact that the interop marshaler reserves a buffer
for the structure that is the size of the structure padded to a multiple
of the size of the first element in the structure.
So in your case 4 +10+15 = 29 padded to a multiple of 4 which gives you
32.
This buffer size is only relevant for the marshaler, you shouldn't care
about it, what counts is that the structure is correctly marshaled to the
native side, that is, correctly aligned and padded.

Note that it's your responsability to balance the alignment of the
structures you pass to unmanaged code.

Willy.

"Laurent" <mo********@fre e.fr> wrote in message
news:u3******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
This is probably a dumb question, but I just would like to understand
how the C# compiler computes the size of the managed structure or
classes. I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and
10+15 for the strings). Now, when I debug my source code, the compiler
gives me this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why ?
To make it work, I had to modify the declaration of my class like this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size
instead of hard coding it... Does anyone knows why this happens and what
I should do to make it works correctly ?

Thanks !



Nov 30 '05 #6
Hi Willy,

I guess you're right, but unfortunately I don't have access to the DLL
source code, so I must do my best with what I have. The society which gave
me the DLL also gave me a C++ programm to test it, and I had to modify it to
make it work, adding the #pragma pack(1) declaration in the source code.

Prehaps the DLL has not been well coded (I think they used memcpy, as
you previously said), but I don't know if I can tell them something, and if
I can I don't even know what to tell them. Anyway, thank you for your help
and your explanations !
Laurent

"Willy Denoyette [MVP]" <wi************ *@telenet.be> a écrit dans le message
de news: OG************* @TK2MSFTNGP15.p hx.gbl...
Lauren,

It shouldn't matter, there must be something wrong in the way you fill the
structure in your C code.

If you consider the buffer (array) filled with structures
"ListeCommandes XComm", like this:

|------------->|------------>|-------------->
struct1 struct2 struct3

where (in your case), each struct takes 29 bytes, this means that each
odd index (int) element would be mis-aligned on an odd address, something
that is taken care off by the CLR and the JIT on 32 bit versions of the
OS, but this would fail on some 64 bit systems!
I would suggest you inspect the C code and check how the array gets
filled.
My guess is that:
- Your packing is set to 1 for the compiland, or....
- that structures are getting copied (using memcpy) to addresses in a
buffer calculated using the length of the structure as displacement value.
This leads to non-portable code and a lot of maintenance issues,
especially when you have to transport the buffer to non C code
applications.

Take a look at the following sample (try to compile and run it if you
like), you'll see it works with the SizeOf value returned from the
marshaler using the default C++ alignment, but it will fail when the
alignment is set to anthing other than 4, 8, 16, 32.

//compile using MSFT C++: cl /EHsc /LD strmarsh.cpp
#include <windows.h>
// try this, align to byte (one byte multiples) and see the program fail
// __declspec(alig n(1)) struct str
// using default alignment
struct str
{
int index;
char num[10];
char dat[15];
};

extern "C" {
__declspec( dllexport ) void __stdcall PassStructArr(s tr *st[], int
*number);

}

str *st;
#define SIZEOFARRAY 5
void __stdcall PassStructArr(s tr *strarr[], int *number)
{
st = new str[SIZEOFARRAY];
for(int i = 0; i < SIZEOFARRAY; i++)
{
st[i].index = i;
strcpy( st[i].num, "123456789" );
strcpy( st[i].dat, "12345678901234 " );
}
*strarr = st;
*number = SIZEOFARRAY;
}
using System;
using System.Runtime. InteropServices ;
namespace Willys
{
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)]
public string numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)]
public string dateCommande;
}

class Tester
{

[DllImport("strm arsh")]
extern static void PassStructArr(o ut IntPtr pt, out int number);

static void Main()
{
IntPtr lc = IntPtr.Zero;
int number;
PassStructArr(o ut lc, out number);
// Allocate the array.
ListeCommandesX Comm[] outStructs = new ListeCommandesX Comm[number];
// snippet taken from Nicholas reply on the other thread...
// Cycle through unmanaged memory, and marshal.
for (int index = 0; index < number; index++)
{
// Get the pointer of the location in memory.
IntPtr elementPointer = new IntPtr(lc.ToInt 64() + (index *
Marshal.SizeOf( typeof(ListeCom mandesXComm)))) ;
// Now marshal that value.
outStructs[index] =
(ListeCommandes XComm)Marshal.P trToStructure(e lementPointer,
typeof(ListeCom mandesXComm));
}
DumpArray(outSt ructs);
}
static void DumpArray(Liste CommandesXComm[] outStructs)
{
foreach(ListeCo mmandesXComm lc in outStructs)
Console.WriteLi ne("index {0}, numero {1}, date {2}", lc.index,
lc.numeroComman de, lc.dateCommande );

}
}
}
Willy.
"Laurent" <mo********@fre e.fr> wrote in message
news:Ou******** ******@tk2msftn gp13.phx.gbl...
Hi Willy,
Thanks for your answer. When I say that the code does not work without
the size attribute, it's because I use this class as a parameter for a
function embeded in a C++ DLL, which return me a array of my class (using
double pointers).

So to read this array, I use the pointer returned by the function and,
with the exact size of the array which must be the same as the array
returned by the DLL, I can put element by element the values (I'm not
sure to be undersandable enough, but thanks to Nicholas Paldino for this
tip).

That's why I need to have 29, not 32 ! :-)

"Willy Denoyette [MVP]" <wi************ *@telenet.be> a écrit dans le
message de news: %2************* ***@tk2msftngp1 3.phx.gbl...
What exactly do you mean with:
"To make it work, I had to modify the declaration of my class like this:
[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]

Your code works without the size attribute too!

The 32 comes from the fact that the interop marshaler reserves a buffer
for the structure that is the size of the structure padded to a multiple
of the size of the first element in the structure.
So in your case 4 +10+15 = 29 padded to a multiple of 4 which gives you
32.
This buffer size is only relevant for the marshaler, you shouldn't care
about it, what counts is that the structure is correctly marshaled to
the native side, that is, correctly aligned and padded.

Note that it's your responsability to balance the alignment of the
structures you pass to unmanaged code.

Willy.

"Laurent" <mo********@fre e.fr> wrote in message
news:u3******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
This is probably a dumb question, but I just would like to
understand how the C# compiler computes the size of the managed
structure or classes. I'm working on this class:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi)]
public class MyClass
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

For me, the size of this class is 29 octets (4 for the integer and
10+15 for the strings). Now, when I debug my source code, the compiler
gives me this information: Marshal.SizeOf( typeof(MyClass) ) = 32... Why
? To make it work, I had to modify the declaration of my class like
this:

[StructLayout(La youtKind.Sequen tial, CharSet=CharSet .Ansi, Size=29)]
public class ListeCommandesX Comm
{
public int index;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 10)] public string
numeroCommande;
[MarshalAs(Unman agedType.ByValT Str, SizeConst = 15)] public string
dateCommande;
}

It works, but I'd prefer the compiler to compute the real size
instead of hard coding it... Does anyone knows why this happens and
what I should do to make it works correctly ?

Thanks !



Dec 1 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3283
by: John | last post by:
Hi all, Can a linked list be a member of a structure? If so, when I add or remove an element from the linked list, the size of the structure will change. Will it cause any problem? Thanks a lot. John
13
3889
by: Amarendra | last post by:
Folks, This structure padding issue is bothering me now, could not locate a satisfactory answer on clc, so here it goes... I have a structure, given below: typedef struct { int flag; char keys; char padding;
2
1854
by: Sachin | last post by:
typdef struct { int i; char ch; }str; str str_var; char x, y; main() { //do nothing
10
2309
by: ranjeet.gupta | last post by:
Dear All !! Before i qoute my querry, I will like to qoute my analysis and my Knowledge Struct a { int raw; char data; };
4
3896
by: marco_segurini | last post by:
Hi, From my VB program I call a C++ function that gets a structure pointer like parameter. The structure has a field that contains the structure length and other fields. My problem is that each 'double' fields get 12 bytes instead of 8 so the structure length results wrong. '----Sample
4
11211
by: junky_fellow | last post by:
Can somebody please tell me about the structure alignment rules ? What I found was that on my system (cygwin running on PC, size of int=4 sizeof long=4, size of long long = 8) the cygwin compiler put the padding after the last member of structure. For eg, struct test { int i; char c; /* no padding required between int and char */ /* 3 byte padding is inserted here, Why ? */
15
2237
by: kris | last post by:
Hi I am writing a small program where I need to obtain the actual size of a structure. The programm is as follows struct abc { int j; char k; int i; }*a;
5
3794
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);" I thought that it is very hard to memory map structure array. I need both read and write memory mapped file at both side of C# and C++.
6
4874
by: carles | last post by:
Hi, Here, sample code where a byte array is used to fill a particular structure: fs = File.OpenRead(path); // FileStream BITMAPFILEHEADER bfh = new BITMAPFILEHEADER(); b = new byte;
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.