Click here to Skip to main content
15,907,326 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralKeep the cursor inside a window Pin
Daniela12330-May-03 11:36
Daniela12330-May-03 11:36 
GeneralRe: Keep the cursor inside a window Pin
Michael Dunn30-May-03 11:50
sitebuilderMichael Dunn30-May-03 11:50 
GeneralRe: Keep the cursor inside a window Pin
Anonymous31-May-03 17:18
Anonymous31-May-03 17:18 
Generalraw packet with setsockopt() and sendto() Pin
Kuniva30-May-03 11:32
Kuniva30-May-03 11:32 
GeneralRe: raw packet with setsockopt() and sendto() Pin
JohnnyG30-May-03 18:34
JohnnyG30-May-03 18:34 
GeneralRe: raw packet with setsockopt() and sendto() Pin
Kuniva31-May-03 5:11
Kuniva31-May-03 5:11 
GeneralRe: raw packet with setsockopt() and sendto() Pin
JohnnyG31-May-03 13:20
JohnnyG31-May-03 13:20 
GeneralRe: raw packet with setsockopt() and sendto() Pin
Peter Weyzen30-May-03 22:01
Peter Weyzen30-May-03 22:01 
along with Johnny's great comments, one thing struck me.

Since your tcp/ip/udp headers are "raw" network data -- they should be packed? Or am I wrong?

#pragma pack(push,1)<br />
struct<br />
{<br />
  BYTE x;<br />
  BYTE y;<br />
};<br />
#pragma pack(pop)


As I recall, structure members are aligned on DWORD boundaries by default. That is, that a struct like the one above would have 3 bytes of unused data between x and y. You can verify by doing a sizeof() on your data.

Packing it forces the structure members to line up one directly following the next (no space between items).

When in doubt, I always force things to pack for creating network packet headers....

Does this make sense? Does this apply? Am I incorrect?

-p

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks

GeneralMySQL in a small app... Pin
Gnascher30-May-03 10:25
Gnascher30-May-03 10:25 
GeneralRe: MySQL in a small app... Pin
Robert Little30-May-03 11:12
Robert Little30-May-03 11:12 
GeneralRe: MySQL in a small app... Pin
Anonymous30-May-03 12:00
Anonymous30-May-03 12:00 
GeneralRe: MySQL in a small app... Pin
Robert Little30-May-03 18:21
Robert Little30-May-03 18:21 
GeneralRe: MySQL in a small app... Pin
Neville Franks30-May-03 13:29
Neville Franks30-May-03 13:29 
GeneralRe: MySQL in a small app... Pin
Gnascher30-May-03 14:20
Gnascher30-May-03 14:20 
GeneralRe: MySQL in a small app... Pin
Neville Franks31-May-03 0:21
Neville Franks31-May-03 0:21 
QuestionHow to get control(button) ID in runtime Pin
Roman Muntyanu30-May-03 10:22
Roman Muntyanu30-May-03 10:22 
AnswerRe: How to get control(button) ID in runtime Pin
David Crow30-May-03 10:57
David Crow30-May-03 10:57 
QuestionHow to highlight an item in a list control in report view? Pin
julych30-May-03 10:16
julych30-May-03 10:16 
AnswerRe: How to highlight an item in a list control in report view? Pin
skaanji30-May-03 10:49
skaanji30-May-03 10:49 
AnswerRe: How to highlight an item in a list control in report view? Pin
Michael Dunn30-May-03 11:32
sitebuilderMichael Dunn30-May-03 11:32 
QuestionWhat is the Address of the Active IE ? Pin
Anonymous30-May-03 9:18
Anonymous30-May-03 9:18 
AnswerRe: What is the Address of the Active IE ? Pin
David Crow30-May-03 9:57
David Crow30-May-03 9:57 
GeneralRe: What is the Address of the Active IE ? Pin
Anonymous31-May-03 0:29
Anonymous31-May-03 0:29 
GeneralQuestion for SledgeHammer Pin
doctorpi30-May-03 8:09
doctorpi30-May-03 8:09 
GeneralApplication Design Question Pin
John M. Drescher30-May-03 8:05
John M. Drescher30-May-03 8:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.