Click here to Skip to main content
15,927,745 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
Rickard Andersson206-May-02 21:45
Rickard Andersson206-May-02 21:45 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
6-May-02 21:56
suss6-May-02 21:56 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
Rickard Andersson206-May-02 23:48
Rickard Andersson206-May-02 23:48 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
6-May-02 23:58
suss6-May-02 23:58 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
valikac7-May-02 4:49
valikac7-May-02 4:49 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
valikac7-May-02 4:45
valikac7-May-02 4:45 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
Niklas L6-May-02 22:10
Niklas L6-May-02 22:10 
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
valikac7-May-02 4:39
valikac7-May-02 4:39 
Wow. Nice!

Thanks.

Okay. I want to walk through your code one part at a time.

1)According to the above, you did not use "4" as byte count anywhere in the code. You used a long variable as the static size of the first four bytes. Is that correct? If yes, what is the advantage to using sizeof(long) stead of just this:

// char fourbyte[4];
//send(sock, fourbyte, 4, 0);

2) You used the function htonl() to convert to "net byte order." Jones and Ohlund dedicated a section or so to four functions that converts between byte order (host byte order to/from network byte order). Can you explain why we eed htonl()?

Dire.Wolf posted another technique using WSARevc(). Here is a link to the code.

http://www.gamedev.net/community/forums/topic.asp?topic_id=93771

I will try both your technique and the one Dire.Wolf mentioned. Although, your technique is more flexible in the sense that we do not need to know the size of the data after the first four byte. The size of the data after the first four byte will be calculated and then a character array is created at that size. Very nice!

Thanks again,
Kuphry
GeneralRe: Determining Data Size For Network Send/Rec :: Winsock Pin
7-May-02 19:55
suss7-May-02 19:55 
GeneralEnable/Disable A Window in SplitView :: MFC Pin
valikac6-May-02 18:32
valikac6-May-02 18:32 
GeneralCString! Pin
tongc6-May-02 17:21
tongc6-May-02 17:21 
GeneralRe: CString! Pin
Bugra Barin6-May-02 17:32
Bugra Barin6-May-02 17:32 
GeneralRe: CString! Pin
tongc6-May-02 23:24
tongc6-May-02 23:24 
GeneralRe: CString! Pin
Nish Nishant6-May-02 17:37
sitebuilderNish Nishant6-May-02 17:37 
GeneralRe: CString! Pin
tongc6-May-02 23:24
tongc6-May-02 23:24 
Generala newbie question Pin
dhon6-May-02 17:13
dhon6-May-02 17:13 
GeneralRe: a newbie question Pin
Nish Nishant6-May-02 17:19
sitebuilderNish Nishant6-May-02 17:19 
GeneralBorderless Splitter Pin
alpha+6-May-02 16:59
alpha+6-May-02 16:59 
GeneralRe: Borderless Splitter Pin
Shog96-May-02 17:04
sitebuilderShog96-May-02 17:04 
Generalscreen mate Pin
6-May-02 16:47
suss6-May-02 16:47 
GeneralRe: screen mate Pin
Shog96-May-02 17:06
sitebuilderShog96-May-02 17:06 
GeneralRe: screen mate Pin
Nish Nishant6-May-02 17:21
sitebuilderNish Nishant6-May-02 17:21 
GeneralRe: screen mate Pin
Nish Nishant6-May-02 17:19
sitebuilderNish Nishant6-May-02 17:19 
GeneralRe: screen mate Pin
6-May-02 20:43
suss6-May-02 20:43 
GeneralRe: screen mate Pin
Maxwell Chen6-May-02 21:09
Maxwell Chen6-May-02 21:09 

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.