Metrologic Optimus S Programming Manual page 167

"c" programming guide
Table of Contents

Advertisement

Example
SOCKET s;
...................
if (shutdown (s, 2) < 0) {
}
This routine shuts down part of a previously established TCP connection. Even
Description
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
type
protocol
Example
SOCKET s;
s = socket (PF_INET, SOCK_STREAM, TCP);
if (s < 0) {
}
Description
This routine creates an endpoint for communication and returns a descriptor.
Chapter 3 Terminal Specific Function Library
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
printf ("shutdown fails on socket: %d", s);
...................
Protocol family; this should always be PF_INET or AF_INET.
Socket type
Depending on the type parameter specified, the protocol to be
used can be TCP, UDP, or ICMP.
printf ("SOCKET allocation fails");
...................
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.
161

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents