fragmentation

Reading from a network stream: packet fragmentation

穿精又带淫゛_ 提交于 2019-12-08 07:37:36
问题 I got a server that is managing two clients through NetworkStream.Read . Application protocol is: ClientMessage [128 Bytes] → Response from Server [128 Bytes] Now at server-side: Is it possible, that MyTcpClient.GetStream().Read() returns only < 128 Bytes, although all messages from client-side are exactly 128 bytes long? I guess that such a client message is short enough to fit into one packet on the tcp/ip layer - but could there be some kind of fragmentation or random although? Is

How to use DPI scaling factor (float) to set margins (int)

╄→гoц情女王★ 提交于 2019-12-08 06:17:28
问题 My Android app looks great at 480x800 pixels resolution but it breaks at LDPI screen with 240x400 pixels. I know I can get scaling factor of screen in activity using getResources().getDisplayMetrics().density which would give the exact float value depending upon screen resolution. In my app, I have used RelativeLayout and ImageView s within it, and set the margins of images using setMargins() , as this method uses pixels in int for its top, left, bottom and right values, how can I set these

Reading from a network stream: packet fragmentation

两盒软妹~` 提交于 2019-12-06 15:31:06
I got a server that is managing two clients through NetworkStream.Read . Application protocol is: ClientMessage [128 Bytes] → Response from Server [128 Bytes] Now at server-side: Is it possible, that MyTcpClient.GetStream().Read() returns only < 128 Bytes, although all messages from client-side are exactly 128 bytes long? I guess that such a client message is short enough to fit into one packet on the tcp/ip layer - but could there be some kind of fragmentation or random although? Is NetworkStream.DataAvailable the right attribute to defend against this? After running smoothly for hours, i

Designing and coding a non-fragmentizing static memory pool

谁都会走 提交于 2019-12-06 12:40:16
问题 I have heard the term before and I would like to know how to design and code one. Should I use the STL allocator if available? How can it be done on devices with no OS? What are the tradeoffs between using it and using the regular compiler implemented malloc/new? 回答1: Will try to describe what is essentially a memory pool - I'm just typing this off the top of my head, been a while since I've implemented one, if something is obviously stupid, it's just a suggestion! :) 1. To reduce

Portable way to detect heap fragmentation in c++ at runtime?

微笑、不失礼 提交于 2019-12-06 05:44:18
问题 I'm writing a qt-based c++ application and i need to be able to detect memory fragmentation in order to check if the current system can actually sustain the memory load: the program load a big image (15/21 megapixels are the norm) in memory and then perform some filtering on it (w/ sparse matrices). For instance, i'm having memory fragmentation problem in Windows and VMMap has been very helpful in this: the problem was some DLLs (Wacom tablet "wintab32.dll" and the UltraMon app) doesn't get

C#: Is there an Advantage to Disposing Resources in Reverse Order of their Allocation?

天大地大妈咪最大 提交于 2019-12-06 03:36:14
问题 Many years ago, I was admonished to, whenever possible, release resources in reverse order to how they were allocated. That is: block1 = malloc( ... ); block2 = malloc( ... ); ... do stuff ... free( block2 ); free( block1 ); I imagine on a 640K MS-DOS machine, this could minimize heap fragmentation. Is there any practical advantage to doing this in a C# /.NET application, or is this a habit that has outlived its relevance? 回答1: If your resources are created well, this shouldn't matter (much).

Benefits of “Don't Fragment” on TCP Packets?

不想你离开。 提交于 2019-12-04 16:05:46
问题 One of our customers is having trouble submitting data from our application (on their PC) to a server (different geographical location). When sending packets under 1100 bytes everything works fine, but above this we see TCP retransmitting the packet every few seconds and getting no response. The packets we are using for testing are about 1400 bytes (but less than 1472). I can send an ICMP ping to www.google.com that is 1472 bytes and get a response (so it's not their router/first few hops). I

packet fragmentation for raw sockets

北城以北 提交于 2019-12-04 13:10:14
If I am using raw sockets to send a UDP packet of size 3000bytes, do I need to handle packet fragmentation myself in the code, or should the raw socket handle fragmentation similar to DGRAM socket? Well, if you are using UDP, you aren't really sending RAW. RAW would be no IP at all, in which case yes you have to handle fragmentation yourself. With UDP you get IP's fragmentation support, which is IMHO plenty good enough for short-haul networks where collisions should be minimal. Make the link between the two systems a dedicated subnet, and it isn't an issue at all. What TCP buys you over UDP

Portable way to detect heap fragmentation in c++ at runtime?

无人久伴 提交于 2019-12-04 11:15:19
I'm writing a qt-based c++ application and i need to be able to detect memory fragmentation in order to check if the current system can actually sustain the memory load: the program load a big image (15/21 megapixels are the norm) in memory and then perform some filtering on it (w/ sparse matrices). For instance, i'm having memory fragmentation problem in Windows and VMMap has been very helpful in this: the problem was some DLLs (Wacom tablet "wintab32.dll" and the UltraMon app) doesn't get relocated so are splitting the address space at the 0x10000000-0x30000000 VA of the process. I want to

C#: Is there an Advantage to Disposing Resources in Reverse Order of their Allocation?

[亡魂溺海] 提交于 2019-12-04 09:19:37
Many years ago, I was admonished to, whenever possible, release resources in reverse order to how they were allocated. That is: block1 = malloc( ... ); block2 = malloc( ... ); ... do stuff ... free( block2 ); free( block1 ); I imagine on a 640K MS-DOS machine, this could minimize heap fragmentation. Is there any practical advantage to doing this in a C# /.NET application, or is this a habit that has outlived its relevance? If your resources are created well, this shouldn't matter (much). However, many poorly created libraries don't do proper checking. Disposing of resources in reverse of their