L2 - Harry Course Review-Lecture 2 Outline Blocking and...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Harry 21/09/2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Course Review-Lecture 2 Outline Blocking and Non-blocking Calls Pointer Trap Bytes Order Addresses Connection problems Multi-homed Server Message Boundary
Background image of page 2
1. Blocking Calls A blocking function call will not return until the function is completed or failed.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1.Non-blocking Calls A non-blocking function call will return immediately no matter the function can be completed or not. In default, the socket works in blocking mode.
Background image of page 4
Pointer Trap Return a pointer. char FAR * inet_ntoa( struct in_addr in); in_addr addr1, addr2; printf (“%s %s”, inet_ntoa(addr1), inet_ntoa(addr2)); Problem: the return addresses may be the same, then the second will overwrite the first. Solution: strcpy(str1, inet_ntoa(addr1)); strcpy(str2, inet_ntoa(addr2)); printf (“%s %s”, str1, str2);
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
All socket functions accept and return big-endian numbers only. Winsock/Sockets always return and accept binary addresses in network
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

L2 - Harry Course Review-Lecture 2 Outline Blocking and...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online