
Chapter 3 Terminal Specific Function Library
161
0: shuts down receive data path
1: shuts down send data path and send FIN (final)
2: shuts down both receive and send data path
Example
SOCKET s;
...................
if (shutdown (s, 2) < 0) {
printf ("shutdown fails on socket: %d", s);
...................
}
Description
This routine shuts down part of a previously established TCP connection. Even
if both receive and send data path are shut down, closesocket() must be called
to actually close the socket.
Return
If successful, it returns 0.
On error, it returns -1.
The global variable
errno
is set to indicate the error condition encountered.
See Also
closesocket
socket
Purpose
To create a socket that is bound to a specific service provider.
Syntax
SOCKET socket (int domain, int type, int protocol);
domain
Protocol family; this should always be PF_INET or AF_INET.
type
Socket type
protocol
Depending on the
type
parameter specified, the protocol to be
used can be TCP, UDP, or ICMP.
Example
SOCKET s;
s = socket (PF_INET, SOCK_STREAM, TCP);
if (s < 0) {
printf ("SOCKET allocation fails");
...................
}
Description
This routine creates an endpoint for communication and returns a descriptor.
The
domain
argument specifies a communications domain within which
communication will take place; this selects the protocol family which
should be used.
The socket has the indicated
type
, which specifies the semantics of
communication.
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...